客户端无权作为此发件人发送(Office 365,grails)

我在尝试为grails spring安全插件配置grails邮件插件(https://grails.org/plugin/mail)时不断收到以下错误消息.

这是我到目前为止的配置,


    grails {
        mail {
            host = "smtp.office365.com"
            port = 587
            username = "info@email.com"
            password = "password"
            props = ["mail.smtp.starttls.enable":"true",
                     "mail.smtp.port":"587"]
        }
    }

    grails.mail.default.from = "info@email.com"

这是我的堆栈跟踪.


    .......| Error 2015-04-17 11:59:39,184 [http-bio-8080-exec-8] ERROR errors.GrailsExceptionResolver  - MailSendException occurred when processing request: [POST] /retouch/register/forgotPassword - parameters:
    username: customer
    Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.60 SMTP; Client does not have permissions to send as this sender
    . Stacktrace follows:
    Message: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.60 SMTP; Client does not have permissions to send as this sender
        Line | Method
    ->>  131 | sendMessage    in grails.plugin.mail.MailMessageBuilder
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |     55 | sendMail       in grails.plugin.mail.MailService
    |     59 | sendMail . . . in     ''
    |    156 | forgotPassword in grails.plugin.springsecurity.ui.RegisterController
    |    198 | doFilter . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
    |     63 | doFilter       in grails.plugin.cache.web.filter.AbstractFilter
    |     53 | doFilter . . . in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
    |     49 | doFilter       in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
    |     82 | doFilter . . . in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
    |   1145 | runWorker      in java.util.concurrent.ThreadPoolExecutor
    |    615 | run . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
    ^    745 | run            in java.lang.Thread

注意:问题只能在Grails spring安全插件中找到.

最佳答案
我遇到了完全相同的问题.问题似乎是由于Spring安全性试图将电子邮件中的“from”属性设置为no-reply @ localhost.
尝试将这些行添加到配置文件中

 grails.plugin.springsecurity.ui.register.emailFrom = 'info@email.com'
 grails.plugin.springsecurity.ui.forgotPassword.emailFrom = 'info@email.com'

注意:info@email.com是您的office365电子邮件

转载注明原文:客户端无权作为此发件人发送(Office 365,grails) - 代码日志