package send;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

public class MailTest {
	public static void main(String[] args) {
		SimpleEmail email = new SimpleEmail();
		email.setHostName("smtp.sina.com");//新浪邮件服务器(用于发、收邮件的),POP3/POP是用来取邮件的
		email.setAuthentication("tyf_2013", "*****");//账户,密码
		email.setCharset("UTF-8");
		try {
			email.addTo("zgyd13413876759@sina.com");
			email.setFrom("tyf_2013@sina.com");//必须和Authentication使用的用户相同,否则失败
			email.setSubject("haha");      //标题
			email.setMsg("---------测试中--------");//内容
			email.send();
		} catch (EmailException e) {
			e.printStackTrace();
		}
	}
}
最近下载更多
Tuxxxxx  LV3 2023年1月3日
TerryGaoBo  LV9 2021年8月16日
luesjim  LV11 2021年6月18日
shiopaaa  LV13 2021年6月8日
linhe27  LV7 2021年3月20日
wj3679  LV13 2020年12月22日
lwp011  LV27 2020年7月10日
樊樊樊樊樊樊阵雨  LV18 2020年3月3日
654874339  LV2 2020年1月17日
阿昌先生  LV13 2020年1月16日
最近浏览更多
timi123 2024年4月5日
暂无贡献等级
hbsoft2008  LV16 2023年10月19日
luoxici 2023年5月16日
暂无贡献等级
annazhang  LV29 2023年4月7日
crosa_Don  LV18 2023年2月26日
Tuxxxxx  LV3 2023年1月3日
1358849392  LV21 2022年12月27日
heqian  LV17 2022年12月2日
w20046120 2022年9月1日
暂无贡献等级
heifenglei  LV7 2022年5月27日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友