For this recipe, we will explore how Play applications can send e-mails. We will use the Play module play-mailer to achieve this. We will be utilizing Mandrill, a cloud e-mailer service, to send out e-mails. For more information about Mandrill, please refer to https://mandrill.com/.
For Java, we need to take the following steps:
Run the
foo_java
application with Hot-Reloading enabled:activator "~run"
Declare play-mailer as a project dependency in
build.sbt
:"com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.1"
Enable the play-mailer plugin by declaring it in
foo_java/conf/play.plugins
:1500:com.typesafe.plugin.CommonsMailerPlugin
Specify your
smtp
host information infoo_java/conf/application.conf
:smtp.host=smtp.mandrillapp.com smtp.port=25 smtp.user="YOUR OWN USER HERE" smtp.password="YOUR OWN PASSWORD HERE" smtp.mock=true
Modify
foo_java/app/controllers/Application.java
by adding the following code:import play.libs...