JavaMail出现535 5.7.3 Authentication unsuccessful错误的解决方法
来源:互联网 发布:唯一旅拍怎么样知乎 编辑:程序博客网 时间:2024/05/17 02:45
最近实现使用公司内部邮箱发送邮件功能,发送给本公司邮箱时没有问题,但是给QQ、163或sina等外部邮箱时一直出现错误:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
此时的java mail 版本为1.4.1,升级到1.4.7之后这个问题就没有了。但是出现了错误:
535 5.7.3 Authentication unsuccessful在邮箱配置文件中设置mail.debug为true,在控制台中查看发送邮件时输出的内容:
DEBUG: JavaMail version 1.4.7DEBUG: successfully loaded resource: /META-INF/javamail.default.providersDEBUG: Tables of loaded providersDEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}DEBUG: successfully loaded resource: /META-INF/javamail.default.address.mapDEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]DEBUG SMTP: useEhlo true, useAuth trueDEBUG SMTP: trying to connect to host "exchange.xxxxxxx.com.cn", port 25, isSSL false220 excas1.logic-cn.com Microsoft ESMTP MAIL Service ready at Tue, 28 Apr 2015 18:44:53 +0800DEBUG SMTP: connected to host "exchange.logicsolutions.com.cn", port: 25EHLO xxx.xxx.xxx.xxx//ip地址250-excas1.xxxx-cn.com Hello [xxx.xxx.xxx.xxx]250-SIZE 37748736250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-X-ANONYMOUSTLS250-AUTH NTLM250-X-EXPS GSSAPI NTLM250-8BITMIME250-BINARYMIME250-CHUNKING250 XRDSTDEBUG SMTP: Found extension "SIZE", arg "37748736"DEBUG SMTP: Found extension "PIPELINING", arg ""DEBUG SMTP: Found extension "DSN", arg ""DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""DEBUG SMTP: Found extension "STARTTLS", arg ""DEBUG SMTP: Found extension "X-ANONYMOUSTLS", arg ""DEBUG SMTP: Found extension "AUTH", arg "NTLM"DEBUG SMTP: Found extension "X-EXPS", arg "GSSAPI NTLM"DEBUG SMTP: Found extension "8BITMIME", arg ""DEBUG SMTP: Found extension "BINARYMIME", arg ""DEBUG SMTP: Found extension "CHUNKING", arg ""DEBUG SMTP: Found extension "XRDST", arg ""DEBUG SMTP: Attempt to authenticate using mechanisms: NTLMDEBUG NTLM: type 1 message: 4E 54 4C 4D 53 53 50 00 01 00 00 00 03 A2 00 00 00 00 00 00 23 00 00 00 03 00 03 00 20 00 00 00 31 39 32 DEBUG SMTP: AUTH NTLM command trace suppressedDEBUG NTLM: type 3 message: 4E 54 4C 4D 53 53 50 00 03 00 00 00 18 00 18 00 86 00 00 00 18 00 18 00 9E 00 00 00 00 00 00 00 40 00 00 00 40 00 40 00 40 00 00 00 06 00 06 00 80 00 00 00 00 00 00 00 B6 00 00 00 01 82 00 00 72 00 65 00 63 00 72 00 75 00 69 00 74 00 69 00 6E 00 67 00 40 00 6C 00 6F 00 67 00 69 00 63 00 73 00 6F 00 6C 00 75 00 74 00 69 00 6F 00 6E 00 73 00 2E 00 63 00 6F 00 6D 00 2E 00 63 00 6E 00 31 00 39 00 32 00 83 BF 3A A6 03 EF 29 16 17 C7 7E 2A AF 63 C0 24 C7 D1 87 84 53 D1 16 DA 7D 9F D1 2D 63 E0 48 AD 9D 21 FA 53 E8 C9 72 16 A6 E6 33 9A 2B 9A C1 89 DEBUG SMTP: AUTH NTLM failed可见问题是由:AUTH NTLM failed引起的。
修改配置文件中的邮箱配置:
<bean id="mail" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<span style="white-space:pre"></span><property name="host" value="${mail.smtp.host}" /><property name="port" value="${mail.smtp.port}" /><property name="username" value="${mail.user}" /><property name="password" value="${mail.password}" /> <property name="javaMailProperties"> <span style="white-space:pre"></span><props> <prop key="mail.transport.protocol">smtp</prop> <prop key="mail.smtp.auth">true</prop> <prop key="mail.debug">true</prop> <prop key="mail.smtp.auth.mechanisms">NTLM</prop> <prop key="mail.smtp.auth.ntlm.domain">xxxx-cn.com</prop> </props> </property></bean>
需要注意的是username是登陆邮箱是的用户名而不是邮箱,password是登陆邮箱的密码,mail.smtp.auth.ntlm.domain是邮箱服务器的domain。
0 0
- JavaMail出现535 5.7.3 Authentication unsuccessful错误的解决方法
- jenkins配置发送邮件报Authentication unsuccessful错误解决方法
- SMTP Server reply:535 5.7.3 Authentication unsuccessful
- Java Mail邮件SMTP协议返回信息 535 5.7.3 Authentication unsuccessful.
- Java Mail邮件SMTP协议返回信息 535 5.7.3 Authentication unsuccessful
- JavaMail开发535 5.7.8 authentication failed错误处理
- 邮件发送出现错误:535 #5.7.0 Authentication failed
- MCC出现错误这样的 ERROR 1251: Client does not support authentication pro 解决方法
- 邮件发送出现错误:535 Authentication failed
- 用JavaMail开发常出现的错误
- javamail出现550错误。
- 出现错误的解决方法:
- 出现错误的解决方法:
- testsaslauthd出现0: NO "authentication failed"的解决方法
- testsaslauthd出现0: NO "authentication failed"的解决方法
- Ubuntu出现Authentication failure(认证失败)的解决方法
- 关于javamail-with-ms-exchange-no-authentication-mechansims-supported-by-both-server错误的解决办法
- testsaslauthd出现0: NO "authentication failed"错误提示的解决办法
- 项目实践——Easyui中tree的使用
- hibernate 二级缓存配置
- iOS 检测版本更新
- uva 10066 lcs 水题
- 今天想独立写个微信的项目
- JavaMail出现535 5.7.3 Authentication unsuccessful错误的解决方法
- Notification的总结
- Ubuntu 14.04下成功安装ffmpeg与编译配置opencv-2.4.10
- 2015/4/28总结--git编辑文件---sts创建动态工程
- 使用 Rails Active Resource 简化 web 应用程序之间的互操作性
- 斐波那契数(C/C++,Scheme)
- 在eclipse运行maven命令时报在jre里找不到jar包
- UVA 225 Golygons(DFS + sort)
- JAVA基础详细笔记Java入门到精通JAVA学习笔记