网易云邮箱接收验证信息
需要到一个邮箱的jar包,如下
public final class MailUtils {
// 这里填写发件人邮箱地址(即设置了授权码的邮箱地址)
private static final String USER = "xxxxxx@163.com";
private static final String PASSWORD = "xxxxxx"; // 你设置的授权码
/**
*
* @param to 收件人邮箱
* @param text 邮件正文
* @param title 标题
*/
/* 发送验证信息的邮件 */
public static boolean sendMail(String to, String text, String title){
try {
final Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.host", "smtp.163.com");
// 发件人的账号
props.put("mail.user", USER);
//发件人的密码
props.put("mail.password", PASSWORD);
// 构建授权信息,用于进行SMTP进行身份验证
Authenticator authenticator = new Authenticator() {