JavaMail发送邮件应添加客户端授权密码而不是登陆密码

Exception in thread "main" javax.mail.AuthenticationFailedException: 535 Error: authentication failed

    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932)
    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:843)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:748)
    at javax.mail.Service.connect(Service.java:366)
    at javax.mail.Service.connect(Service.java:246)
    at javax.mail.Service.connect(Service.java:267)
    at mail.send(mail.java:37)
    at main.main(main.java:21)

登陆认证失败,一开始填的是163邮箱登陆密码,后来因为启用了smtp服务后客户端授权密码,这个密码只在发给手机的短信里出现一次

猜你喜欢

转载自www.cnblogs.com/ming-szu/p/9110233.html