0
我使用下面的conf通过play-easymail在播放v2.2中发送电子邮件 - 我没有看到任何异常抛出我的代码&我已经尝试了本地SMTP服务器以及来自gmail的SMTP服务。我无法收到电子邮件(不在任何垃圾邮件文件夹中)。有关解决此问题的任何建议(除了检查本地SMTP服务器日志),将不胜感激。 SMTP配置通过application.config文件导入。问题与播放easymail使用播放框架2.2
CONF
# SMTP mailer settings
smtp {
# enable mocking - disable this for production
mock=true
# SMTP server
# (mandatory)
# defaults to gmail
host=smtp.gmail.com
# SMTP port
# defaults to 25
port=587
# Use SSL
# for GMail, this should be set to true
ssl=true
#tls=true
# authentication user
# Optional, comment this line if no auth
# defaults to no auth
[email protected]"
# authentication password
# Optional, comment this line to leave password blank
# defaults to no password (or use (two way) hash the pwd and get the pwd from the two way hash)
password=correctPwd
}
测试代码
import com.feth.play.module.mail.Mailer;
import com.feth.play.module.mail.Mailer.Mail.Body;
//email method: emailAddress passed is correct
try {
final Body body = new Body("test email");
Mailer.getDefaultMailer().sendMail("metrics email | it works!",
body, emailAddress);
}
catch (Exception e) {
Logger.info("exception while sending email {}", e);
e.printStackTrace();
}