QQ企业邮箱使用Java代码发送失败,错误DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NT
来源:互联网 发布:zara淘宝 编辑:程序博客网 时间:2024/06/05 07:11
先前使用的代码:
String host = "xxx";
String from = "xxx";
String name = "xx";
String sender = "XXX";
String pwd = XXX";
String port = "465";
Properties prop = new Properties();
//协议
prop.setProperty("mail.transport.protocol", "smtp");
//服务器
prop.setProperty("mail.smtp.host", host);
//端口
prop.setProperty("mail.smtp.port", port + "");
//使用smtp身份验证
prop.setProperty("mail.smtp.auth", "true");
//使用SSL,企业邮箱必需!
//开启安全协议
MailSSLSocketFactory sf = null;
try {
sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
} catch (GeneralSecurityException e1) {
e1.printStackTrace();
}
prop.put("mail.smtp.ssl.enable", "true");
prop.put("mail.smtp.ssl.socketFactory", sf);
Session session = Session.getDefaultInstance(prop, new MyAuthenricator(name, pwd));
session.setDebug(true);
// 建立邮件消息
MimeMessage mailMessage = new MimeMessage(session);
Transport.send(mailMessage);
然而却出错了!
DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM
DEBUG SMTP: AUTH LOGIN command trace suppressed
DEBUG SMTP:AUTH LOGIN failed
2017-05-04 16:41:35.589 ERROR com.rbao.east.task.TaskJobImpl - 182 -
sendEmail error mailMessage=javax.mail.internet.MimeMessage@39f840f5
javax.mail.AuthenticationFailedException: 535 Error: authentication failed, system busy
登陆授权失败!
弄了半天,将上述代码开启安全协议改了下:
prop.put("mail.smtp.starttls.enable", "true");
prop.put("mail.smtp.socketFactory.port", port);
prop.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
最终发送成功了!!!
- QQ企业邮箱使用Java代码发送失败,错误DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NT
- SMTP身份验证(LOGIN、PLAIN、CRAM-MD5)
- SMTP(Login,Plain,CRAM-MD5)验证
- Zookeeper 错误 Will not attempt to authenticate using SASL (unknown error)
- 使用QQ企业邮箱465端口发送邮件失败
- SMTP验证方式种类(LOGIN、PLAIN、CRAM-MD5)
- SMTP验证方式种类(LOGIN、PLAIN、CRAM-MD5)
- Will not attempt to authenticate using SASL (java.lang.SecurityException: 无法定位登录配置)
- Connection refused Will not attempt to authenticate using SASL
- 在postfix使用qq企业邮箱的smtp
- Eclipse下调试HBase程序报“Will not attempt to authenticate using SASL (java.lang.SecurityException : 无法定位登”
- phpmailer发送邮件 SMTP Error: Could not authenticate 错误
- django使用QQ企业邮箱发送邮件
- Laravel 使用腾讯企业邮箱的 smtp 发送邮件
- C#使用SMTP协议发送邮件(腾讯企业邮箱)
- hbase windowns 下, Will not attempt to authenticate using SASL (无法定位登录配置)
- Zookeeper报错Will not attempt to authenticate using SASL解决办法
- zookeeper的Will not attempt to authenticate using SASL (无法定位登录配置)
- Oracle11g安装在CentOS6.5
- spring初始化bean InitializingBean
- tty命令查看当前用的是哪个console在显示
- Hibernate运行过程
- 编写可以监控oracle监听器是否启动的shell脚本
- QQ企业邮箱使用Java代码发送失败,错误DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NT
- C++ Socket多客户端和服务器通信
- select poll epoll
- 制作SVG图片的CSS文字样式,引入项目
- shim和polyfill有什么区别
- DHCP信息交互过程详解
- 告别session! spring 集成 jwt 验证方式
- HDU 5009 Paint Pearls
- tf.get_variable() vs tf.Variable(),tf.name_scope() vs tf.variable_scope()