2

メールプラグイン1.0.1を備えたgrails 2.2.1アプリがあります。

アプリをローカルで実行すると (grails dev run-app)、Gmail smtp サーバー経由のメール配信は正常に機能しますが、war ファイルとしてデプロイする運用サーバー ( Jelasticクラウド プラットフォーム上) では失敗します。

構成グルービー:

// Mail
grails {
   mail {
     host = "smtp.gmail.com"
     port = 465
     username = "aut********@gmail.com"   // *** = just blacked out
     password = "sun1******"              // *** = just blacked out
       props = ["mail.smtp.auth":"true",
                "mail.smtp.starttls.required": "false",
                "mail.smtp.socketFactory.port":"465",
                "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
                "mail.smtp.socketFactory.fallback":"false"]
   }
}

しかし、私はメール プラグイン構成を 1 つしか持っていないため、その構成が開発環境と実稼働環境の両方に適用されると想定しています。

実際、war ファイルを解凍してクラス (私の場合は Config$_run_closure2_closure8_closure13.class) を逆コンパイラでチェックすると、そこに正しい設定値が表示されます。

ここに画像の説明を入力

拡大: http://i.troll.ws/638ef33d.png

エラーメッセージ:

Caused by: org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 http://support.google.com/mail/bin/answer.py?answer=14257 d47sm23030880eem.9 - gsmtp

    at grails.plugin.mail.MailMessageBuilder.sendMessage(MailMessageBuilder.groovy:104)
    at grails.plugin.mail.MailService.sendMail(MailService.groovy:41)
    at MailGrailsPlugin$_configureSendMail_closure6.doCall(MailGrailsPlugin.groovy:170)
    at com.oritrack.core.ApiController.register(ApiController.groovy:212)
    ... 5 more
Caused by: javax.mail.AuthenticationFailedException: 535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 http://support.google.com/mail/bin/answer.py?answer=14257 d47sm23030880eem.9 - gsmtp

    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:648)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:583)
    at javax.mail.Service.connect(Service.java:291)
    ... 9 more   

認証が失敗するのは非常に奇妙です。したがって、少なくとも適切なサーバーに接続しようとしています。Config.groovy のユーザー名/パスワードは、私がそこに持っているメールプラグイン設定の唯一のセットです。ローカルで実行する場合は、別の場所で実行する必要があります。

4

1 に答える 1