1、pom,xml
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
2 、properties.ini
#默认的smtp域名
smtpServer = smtp.mxhichina.com
# 端口:非加密25,ssl加密465
port= 465
#阿里邮箱账号
fromUser =test@test.com
#邮箱密码
fromUserPassword= ****
3.实体类
public class EmailInfo {
private String smtpServer;// SMTP服务器地址
private String port; // 端口
private String fromUser;// 登录SMTP服务器的用户名,发送人邮箱地址
private String fromUserPassword;// 登录SMTP服务器的密码
private String toUser; // 收件人
private String subject; // 邮件主题
private String content; // 邮件正文
public EmailInfo() { }
public EmailInfo(String toUser, String subject, String content) {
this.toUser = toUser;
this.subject = subject;
this.content = content;
this.smtpServer = PropKit.use("pro


3039

被折叠的 条评论
为什么被折叠?



