试图在application.conf
heroku玩!与sendgrid配置
mail.smtp.host=smtp.sendgrid.net
mail.smtp.user=${SENDGRID_USERNAME}
mail.smtp.pass=${SENDGRID_PASSWORD}
和Controller
MultiPartEmail email = new MultiPartEmail();
//... setting from,to,subject,content...
Mail.send(email); //using Play's util
但异常发生时配置SMTP,认证的SMTP服务器时,说不好的用户凭据。
有一两件事我注意到的是,当推到的Heroku和启动应用程序,它会发出警告:
WARNING: Cannot replace SENDGRID_USERNAME in configuration (mail.smtp.user=${SENDGRID_USERNAME})
WARNING: Cannot replace ENV_SENDGRID_PASSWORD in configuration (mail.smtp.pass=${SENDGRID_PASSWORD})
这可能是由于预编译标志是,当部署?这里是我的Procfile
:
web: play run --http.port=$PORT --%prod
这是'git push'时间的错误吗?如果是这样,你可以忽略它。你是否收到'Mail.send()'的异常? – 2012-02-17 20:08:21
'git push'没有错误,只是警告。 “Mail.send()”例外是来自不良用户凭证。我试过,如果我直接在代码中使用'System.getenv(“SENDGRID_USERNAME”)'并使用'MultipartEmail'的'send',它可以发送。但在这种情况下,我无法使用内置的邮件模拟器进行本地测试。 – jackysee 2012-02-18 23:49:25