Problème avec EasyMail de jeu tout en utilisant Play Framework 2.2
-
21-12-2019 - |
Question
J'utilise la Conf Ci-dessous pour envoyer des emails dans la lecture V2.2 via Play-Easyymail - Je ne vois aucune exception lancée dans mon code et j'ai essayé à la fois un serveur SMTP local ainsi que le service SMTP deGmail.Je n'ai pas pu recevoir l'email (ce n'est pas dans aucun dossier de courrier indésirable).Toute suggestion sur le dépannage de cette option (en plus de vérifier que les journaux locaux du serveur SMTP) seront appréciés. La configuration SMTP est importée via le fichier application.config.
# 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
user=correctEmail@gmail.com"
# 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();
}
La solution
C'était une erreur pilote.Je devais régler la simulation égale à False dans le fichier Conf.J'ai pu envoyer des courriels après ce changement.
mock=false
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow