关于java 代码连接邮箱服务器,有几个配置需要了解
String user = “你的邮箱地址”;
String password = “你的邮箱授权码”;
String host = “smtp.163.com”;
String from = “你的邮箱地址”;
String to = “目标邮箱地址”;
props.put(“mail.smtp.host”, host );// 设置发送邮件的邮件服务器的属性(这里使用网易的smtp服务器)
props.put(“mail.smtp.auth”, “true”); // 需要经过授权,也就是有户名和密码的校验,这样才能通过验证(一定要有这一条
props.put(“mail.smtp.ssl.trust”, host );
注;关于邮箱授权码在网易邮箱中获取,具体操作:
https://jingyan.baidu.com/article/8ebacdf065a1f149f65cd5b5.html