我使用Grails 2.5.1和mail:1.0.7插件发送电子邮件,但当我使用它时,总是会收到以下错误:
Class:javax.mail.AuthenticationFailedExceptionMessage:535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/answer/14257 qq4sm4579366wjc.14 - gsmtp尽管我可以从浏览器成功地使用提供的凭据登录!
下面是我在Config文件中的配置:
grails {
mail {
host = "smtp.gmail.com"
port =465
username = "****"
password = "***"
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]
}
}下面是我们的行动:
mailService.sendMail{
to userInstance.toEmail
subject userInstance.subject
html "<strong>Test</strong> "
} 我遗漏了什么吗?
发布于 2017-01-24 07:44:20
这可能是因为gmail的安全功能,不太安全的应用程序得到认证。只需打开不太安全的应用程序的访问权限即可。
遵循以下步骤:
1登录到你的gmail帐户
2访问url:https://www.google.com/settings/security/lesssecureapps
3选择“打开”
发布于 2015-10-10 14:50:00
如果你有gmail -插件设置是正确的(我有同样的,他们正在工作),但如果你的电子邮件不是gmail,你必须有其他配置。
顺便问一下,如果你是gmail的话:
Username and Password not accepted.您的用户名或密码是错误的,请尝试使用此用户名和密码登录,注意字母的注册。 https://grails.org/plugin/mail
https://stackoverflow.com/questions/33048307
复制相似问题