zoukankan      html  css  js  c++  java
  • Android 使用 Gmail 来发送邮件

    SendMail.java
    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 }
  • 相关阅读:
    Math Jax开源数学编辑器的使用
    阿里云pai项目使用说明
    tomcat管理授权:tomcat-users.xml
    NoSQLBooster for MongoDB的基本使用
    IDEA的配置文件访问
    task
    Netty基础点滴
    二星权限树的设计与实现
    easyui实现树形菜单Tab功能、layout布局
    如何用Dome4j(2.2.1)创建Xml
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/2469088.html
Copyright © 2011-2022 走看看