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

play activator-runtimeException:需要在application.conf中设置smtp.host才能使用此插件(或将smtp.mock设置为true),exception,playframework,playframework-2.0,typesafe-activator,Exception,Playframework,Playframework 2.0,Typesafe Activator,我正在尝试运行名为“playStartApp”的play activator模板。 但是,它给了我以下运行时异常: 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 applicatio

我正在尝试运行名为“playStartApp”的play activator模板。 但是,它给了我以下运行时异常:

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?
在“playStartApp”激活器模板中,您可以-

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

    smtp.mock=true
    
    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
    
  • 模拟选项将向控制台呈现电子邮件输出。如果您使用的是ActivatorUI,您将能够在“运行”选项卡上的日志中看到邮件输出

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

    smtp.mock=true
    
    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
    
  • 你也可以使用gmail服务器发送邮件,这一点我已经在上面提到过了

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

    资源(播放文档):


    我也遇到了同样的问题,您找到解决方案了吗?在测试期间,如果您使用新的GlobalSettings,则不会加载您的conf。在这种情况下,将smtp.mock作为配置传递给全局设置:-
    HashMap configMap=new HashMap();configMap.put(“smtp.mock”,true);application=play.test.Helpers.fakeApplication(configMap,new GlobalSettings())