2021.5.3 团队冲刺第六天

今天做了验证码

public static void SendEmail(String title,String content,String emailAddress) throws GeneralSecurityException, MessagingException {
//创建一个配置文件并保存
Properties properties = new Properties();

properties.setProperty("mail.host","smtp.qq.com");

properties.setProperty("mail.transport.protocol","smtp");

properties.setProperty("mail.smtp.auth","true");


//QQ存在一个特性设置SSL加密
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
properties.put("mail.smtp.ssl.enable", "true");
properties.put("mail.smtp.ssl.socketFactory", sf);

//创建一个session对象
Session session = Session.getDefaultInstance(properties, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("ll.alice@foxmail.com","dvnanakbhbdsbaij");
}
});
原文地址:https://www.cnblogs.com/buxiang-Christina/p/14909652.html