Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play activator - runtimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)

I am trying to run play activator template named "playStartApp". But, it is giving me following runtime exception:

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?
like image 690
Parth Ramnik shah Avatar asked Oct 20 '22 01:10

Parth Ramnik shah


1 Answers

In the "playStartApp" activator template, you can either -

  1. Use a mock mailer, by entering the following in conf/application.conf

    smtp.mock=true
    

The mock option will render email output to the console. If you are using the Activator UI, you'll be able to see the mail output in the logs on the "Run" tab.

  1. Mention the SMTP server details in conf/application.conf

    smtp.host=smtp.gmail.com
    smtp.port=587
    smtp.user="[email protected]"
    smtp.password="password"
    smtp.ssl=true
    mail.from="[email protected]"
    mail.sign=The PlayStartApp Team
    

You can use gmail servers for sending mails as well, which I have mentioned above.

Alternatively, in the "playStartApp", just rename conf/mail.conf.example to conf/mail.conf and move all your SMTP related configuration here. Please note that conf/mail.conf is mentioned in .gitignore.

Resources (Play Documentation):

Mail configuration parameters

SMTP Configuratoin

like image 160
Denny Abraham Cheriyan Avatar answered Oct 29 '22 15:10

Denny Abraham Cheriyan