O'Reilly logo

Play Framework Cookbook - Second Edition by Giancarlo Inductivo, Alexander Reelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Utilizing play-mailer

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/.

How to do it…

For Java, we need to take the following steps:

  1. Run the foo_java application with Hot-Reloading enabled:
        activator "~run"
    
  2. Declare play-mailer as a project dependency in build.sbt:
        "com.typesafe.play.plugins" %% "play-plugins-mailer" % "2.3.1"
  3. Enable the play-mailer plugin by declaring it in foo_java/conf/play.plugins:
        1500:com.typesafe.plugin.CommonsMailerPlugin
  4. Specify your smtp host information in foo_java/conf/application.conf:
     smtp.host=smtp.mandrillapp.com ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required