Problema con Play-Easymail durante l'utilizzo di Play Framework 2.2
-
21-12-2019 - |
Domanda
Sto usando il conf di seguito per l'invio di e-mail in Play V2.2 tramite Play-Easymail - Non vedo alcuna eccezione lanciata nel mio codice e ho provato sia un server SMTP locale che come il servizio SMTPGmail.Non sono stato in grado di ricevere l'e-mail (non è in nessuna cartella di posta indesiderata).Eventuali suggerimenti sulla risoluzione dei problemi questo (oltre a controllare i registri server SMTP locali) saranno apprezzati. La configurazione SMTP viene importata tramite il file application.config.
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
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
}
.
Codice test
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();
}
. Soluzione
Era un errore pilota.Ho dovuto impostare il simpatico uguale a false nel file Conf.Sono stato in grado di inviare e-mail dopo questo cambiamento.
mock=false
. Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow