Android 使用 Gmail 来发送邮件
Android 使用 Gmail 来发送邮件
1. [代码]SendMail.java
package org.apache.android.mail;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class SendMail extends Activity {
/**
* Called with the activity is first created.
*/
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
final Button send = (Button) this.findViewById(R.id.send);
final EditText userid = (EditText) this.findViewById(R.id.userid);
final EditText password = (EditText) this.findViewById(R.id.password);
final EditText from = (EditText) this.findViewById(R.id.from);
final EditText to = (EditText) this.findViewById(R.id.to);
final EditText subject = (EditText) this.findViewById(R.id.subject);
final EditText body = (EditText) this.findViewById(R.id.body);
send.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
GMailSender sender = new GMailSender(userid.getText().toString(),
password.getText().toString());
try {
sender.sendMail(subject.getText().toString(),
body.getText().toString(),
from.getText().toString(),
to.getText().toString());
} catch (Exception e) {
Log.e("SendMail", e.getMessage(), e);
}
}
});
}
}
Android 使用 Gmail 来发送邮件的更多相关文章
- java mail 使用 gmail smtp 发送邮件
smtp 服务器:smtp.gmail.com 使用ssl的端口:465 用户名:username@gmail.com 密码:password** 基本配置没有问题,关键在于Google对安全性要求非 ...
- android使用微软EWS发送邮件
通常我们在android使用javamail发送邮件,可是很多时候我们需要连接Exchange服务(很多公司内部邮件服务器采用,并且未开通smtp服务)来发送邮件,这时候我们就要用到微软的 ews-j ...
- SpringBoot 2.x 集成QQ邮箱、网易系邮箱、Gmail邮箱发送邮件
在Spring中提供了非常好用的 JavaMailSender接口实现邮件发送,在SpringBoot的Starter模块中也为此提供了自动化配置. 项目源码已托管在Gitee-SpringBoot_ ...
- Android 调用系统邮件,发送邮件到指定邮箱
在项目中,最后有一个联络我们,要求是点击号码还有邮箱地址能够发送邮件,这时候解决的方案其实有两种,一种是调用系统发邮件的软件,可以添加邮箱账号就可以发送邮件:第二种是使用javamail来发送邮件.在 ...
- 使用spring boot配置Gmail邮箱发送邮件
最近项目有用到配置Gmail来发送通知邮件给客户,由于国内众所周知的原因,联调测试中遇到了一些问题,不过好在都一一解决了,现在做个记录,也给其他同仁做个参考. 相关配置: spring.mail.ho ...
- Android开发之JavaMail发送邮件(用户反馈)
给APP增加了一个用户反馈的小功能,由于懒的搭服务器,所以就用邮件的形式进行通信,有如下两种方式: 1.使用调用手机上的其他程序完成邮件发送 2.使用javamail进行邮件发送 这里果断使用java ...
- 【最后一篇API译文】Android开发-API指南- Contacts Provider
Contacts Provider 今年加入了某字幕组,加之杂事颇多,许久未添新文了,惭愧之极. 在听闻 Google 即将重返中国后,近日忽又发现官方网站正在放出 API 中文版,比如本文.当然不是 ...
- Android网页中tel,sms,mailTo,Intent,Market协议用法总结
tel:协议---拨打电话 <a href="tel:">调出拨号界面</a> <a href="tel:10086">调 ...
- 转--2014年最新810多套android源码2.46GB免费一次性打包下载
转载自:http://www.eoeandroid.com/thread-497046-1-1.html 感谢该博客主人无私奉献~~ 下面的源码是从今年3月份开始不断整理源码区和其他网站上的安卓例子源 ...
随机推荐
- 1050 数的计数 c语言实现
描述 给定一个正整数,求其各位之和. 输入 输入一行,为一个正整数(最多10,000位). 输出 输出各位之和. 样例输入 17 样例输出 8 解析:这题主要是大数计算的问题,因为10000位的数无法 ...
- Cutting Sticks
题意: l长的木棒,给出n个切割点,每切一次的费用为切得木棒的长度,完成切割的最小费用. 分析: 区间dp入门,区间dp的特点,一个大区间的解可以转换成小区间的解组合起来,每个切割点的标号代表边界. ...
- codeforces 675D Tree Construction set
转自:http://blog.csdn.net/qwb492859377/article/details/51447350 #include <stdio.h> #include < ...
- 【剑指offer 面试题7】用两个栈实现队列
#include <iostream> #include <stack> using namespace std; template <typename T> cl ...
- 2016传统行业“互联网+”元年,你准备好了吗?
李克强总理在2015年的政府报告中的提出了"互联网+"的概念! 2015年,几十.上百本以"互联网+"作为书名的书出版! 2015年,各种传统行业的信息化被冠上 ...
- Python之Tkinter模块学习
本文转载自:http://www.cnblogs.com/kaituorensheng/p/3287652.html Tkinter模块("Tk 接口")是Python的标准Tk ...
- Multiple reportviewers on one page With reportviwer 11.0
Hi, evreryone: When I use VS 2012 to create report with reportviwer 11.0, I meet a problem abou ...
- Codeforces Round #364 (Div.2) C:They Are Everywhere(双指针/尺取法)
题目链接: http://codeforces.com/contest/701/problem/C 题意: 给出一个长度为n的字符串,要我们找出最小的子字符串包含所有的不同字符. 分析: 1.尺取法, ...
- 安卓升级提示 phoneGap APK软件更新提示
以下代码由PHP200 阿杜整理 package com.example.syzx; import java.io.BufferedReader; import java.io.File; imp ...
- ocp 1Z0-051 71-105题解析
71. Which arithmeticoperations can be performed on a column by using a SQL function that is builtint ...