Android 使用 Gmail 来发送邮件
2012-04-24 23:35
555 查看
SendMail.java
view source
print?
view source
print?
01 | package org.apache.android.mail; |
02 |
03 | import android.app.Activity; |
04 | import android.os.Bundle; |
05 | import android.util.Log; |
06 | import android.view.View; |
07 | import android.widget.Button; |
08 | import android.widget.EditText; |
09 |
10 | public class SendMail extends Activity { |
11 | /** |
12 | * Called with the activity is first created. |
13 | */ |
14 | @Override |
15 | public void onCreate(Bundle icicle) { |
16 | super .onCreate(icicle); |
17 | setContentView(R.layout.main); |
18 | final Button send = (Button) this .findViewById(R.id.send); |
19 | final EditText userid = (EditText) this .findViewById(R.id.userid); |
20 | final EditText password = (EditText) this .findViewById(R.id.password); |
21 | final EditText from = (EditText) this .findViewById(R.id.from); |
22 | final EditText to = (EditText) this .findViewById(R.id.to); |
23 | final EditText subject = (EditText) this .findViewById(R.id.subject); |
24 | final EditText body = (EditText) this .findViewById(R.id.body); |
25 | send.setOnClickListener( new View.OnClickListener() { |
26 | public void onClick(View view) { |
27 | GMailSender sender = new GMailSender(userid.getText().toString(), |
28 | password.getText().toString()); |
29 | try { |
30 | sender.sendMail(subject.getText().toString(), |
31 | body.getText().toString(), |
32 | from.getText().toString(), |
33 | to.getText().toString()); |
34 | } catch (Exception e) { |
35 | Log.e( "SendMail" , e.getMessage(), e); |
36 | } |
37 | } |
38 | }); |
39 | } |
40 | } |
相关文章推荐
- Android系统使用JAVA MAIL发送非gmail邮件(未验证)
- Android 使用 Gmail 来发送邮件
- android平台phonegap开发中使用EmailComposer插件发送邮件带附件失败的问题总结
- android使用javaemail实现发送邮件
- 如何在 Laravel 中使用 SMTP 发送邮件(适用于 163、QQ、Gmail 等)
- Android Java使用JavaMail API发送和接收邮件的代码示例
- android中使用javamail发送邮件附件
- Android中使用Service实现后台发送邮件功能实例
- 如何在 Laravel 中使用 SMTP 发送邮件(适用于 163、QQ、Gmail 等)
- 如何在FOXMAIL上使用GMAIL接送/发送邮件
- phplist及phpmailer(组合使用)通过gmail发送邮件的配置方法
- 使用C#通过GMAIL发送邮件.
- 如何在 Laravel 中使用 SMTP 发送邮件(适用于 163、QQ、Gmail 等)
- Android中使用JavaMail发送邮件
- 用javaMail使用gmail发送邮件,报错:AuthenticationFailedException:534-5.7.14
- 在Delphi中使用indy SMTP发送gmail邮件[转]
- nagios使用gmail发送邮件 取mysql数据库的字段并邮件通知
- Android 调用Gmail发送邮件
- 使用CakePHP自带Email组件通过gmail发送邮件
- C#发送邮件(使用Gmail或自己配置的SMTP)