Pergunta

Eu estou usando o conf abaixo para enviar e-mails em jogar v2.2 via play-easymail - não vejo qualquer exceção lançada em meu código e eu tenho tentado tanto, um servidor de SMTP local, bem como o serviço SMTP do gmail.Eu não tenho sido capaz de receber o e-mail (não em qualquer pasta de lixo eletrônico).Todas as sugestões sobre resolução de problemas este (além de verificar o servidor de SMTP local logs) serão apreciados.O SMTP config é importado através do aplicativo.arquivo de configuração.

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
}

testar o código

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();
}
Foi útil?

Solução

ele foi piloto de erro.Eu tinha que definir de simulação igual a false no arquivo conf.Eu era capaz de enviar e-mails após esta alteração.

mock=false
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top