【问题标题】:Grails Send mail form Gmail Business Mail Exception : Authentication failed; nested exception is javax.mail.AuthenticationFailedExceptionGrails 从 Gmail 商业邮件发送邮件异常:身份验证失败;嵌套异常是 javax.mail.AuthenticationFailedException
【发布时间】:2017-11-16 15:12:18
【问题描述】:

我正在尝试使用 Google 的企业电子邮件帐户发送电子邮件。

我正在使用 Grails 3.2.7 和 Grails 的邮件插件('org.grails.plugins:mail:2.0.0.RC6')。 即使我已设置所有身份验证凭据并且我已将我的帐户设置为允许安全性较低的应用访问,我仍然收到以下异常。

org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException

以下是发送邮件的设置

mail {
    host = 'smtp.gmail.com'
    port = 587
    username = "##### BUSINESS EMAIL from GMAIL###"
    password = "PASSWORD"
    props = ["mail.smtp.auth"                  : "true",
             "mail.smtp.socketFactory.port"    : "465",
             "mail.smtp.socketFactory.class"   : "javax.net.ssl.SSLSocketFactory",
             "mail.smtp.socketFactory.fallback": "false"]
}

任何人都可以帮助解决为什么它不发送电子邮件和身份验证失败。

请注意,如果我尝试使用具有相同设置的普通 GMAIL 帐户发送电子邮件,它可以正常工作。

其他信息 我正在尝试从“来自 GMAIL 的商业电子邮件”的发件人电子邮件向其他域发送电子邮件

【问题讨论】:

    标签: email grails


    【解决方案1】:
    I have sent mail using Grails 3.1.8 and dependency
    compile "org.grails.plugins:mail:2.0.0.RC2".
    
    You can try it in grails 3.2.7
    
      mail {
        host = "smtp.gmail.com"
        port = 465
        username = "test@gmail.com"
        password = "password"
        ssl = "on"
        props = ["mail.smtp.auth"                   : "true",
                 "mail.smtp.port"                   : "465",
                 "mail.smtp.socketFactory.port"     : "465",
                 "mail.smtp.socketFactory.class"    : "javax.net.ssl.SSLSocketFactory",
                 "mail.imap.ssl.checkserveridentity": "false",
                 "mail.imap.ssl.trust"              : "*",
                 "mail.smtp.socketFactory.fallback" : "true"]
     }
    

    【讨论】:

    • 我正在尝试向 Gmail 以外的其他域发送电子邮件,发件人电子邮件将是来自 GMAIL 的 BUSINESS EMAIL。
    猜你喜欢
    • 2020-05-09
    • 2015-11-20
    • 2023-03-10
    • 2012-11-10
    • 2022-07-18
    • 2013-11-30
    • 2019-07-13
    • 1970-01-01
    • 2017-09-22
    相关资源
    最近更新 更多