play activator - runtimeException:需要在application.conf中设置smtp.host才能使用此插件(或将smtp.mock设置为true)

Par*_*hah 5 exception playframework playframework-2.0 typesafe-activator

我正在尝试运行名为"playStartApp"的播放激活模板.但是,它给了我以下运行时异常:

RuntimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)\

    java.lang.RuntimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)
         com.typesafe.plugin.CommonsMailerPlugin$$anonfun$4.apply(MailerPlugin.scala:329)
         com.typesafe.plugin.CommonsMailerPlugin$$anonfun$4.apply(MailerPlugin.scala:329)
         scala.Option.getOrElse(Option.scala:120)
         com.typesafe.plugin.CommonsMailerPlugin.mailerInstance$lzycompute(MailerPlugin.scala:329)
         com.typesafe.plugin.CommonsMailerPlugin.mailerInstance(MailerPlugin.scala:326)
         com.typesafe.plugin.CommonsMailerPlugin.onStart(MailerPlugin.scala:343)
         play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)`


I tried both:
- set mail.smtp=mock

- mail.smtp.host=smtp.gmail.com
mail.smtp.user=yourGmailLogin
mail.smtp.pass=yourGmailPassword
mail.smtp.channel=ssl

pls suggest how to resolve this?
Run Code Online (Sandbox Code Playgroud)

Den*_*yan 3

在“playStartApp”激活器模板中,您可以 -

  1. 通过在conf/application.conf中输入以下内容来使用模拟邮件程序

    smtp.mock=true
    
    Run Code Online (Sandbox Code Playgroud)

模拟选项会将电子邮件输出呈现到控制台。如果您使用的是 Activator UI,您将能够在“运行”选项卡上的日志中看到邮件输出。

  1. 在conf/application.conf中提及SMTP服务器详细信息

    smtp.host=smtp.gmail.com
    smtp.port=587
    smtp.user="user@gmail.com"
    smtp.password="password"
    smtp.ssl=true
    mail.from="PlayStartApp@yourdomain.com"
    mail.sign=The PlayStartApp Team
    
    Run Code Online (Sandbox Code Playgroud)

您也可以使用 gmail 服务器发送邮件,正如我上面提到的。

或者,在“playStartApp”中,只需将 conf/mail.conf.example 重命名为 conf/mail.conf 并将所有 SMTP 相关配置移至此处。请注意 .gitignore 中提到了conf/mail.conf。

资源(播放文档):

邮件配置参数

SMTP 配置