I have just successfully sent an email from Play / Scala. This is what I did:
Add ”com.typesafe.play.plugins” %% “play-plugins-mailer” % “2.3.1” to libraryDependencies (build.sbt)
Add the following to application.conf:
smtp.host=smtp.gmail.com smtp.port=465 smtp.ssl=yes smtp.tls=yes smtp.user="email@example.com" smtp.password=my_password
If you use a ‘!’ in your smtp.password, put a ‘””’ round ‘!’ (as ‘!’ is a reserved character). Change your smtp.user (to your own email address).
- Create a new file conf/play.plugins:
- Add the following to routes:
GET /email controllers.Application.sendEmail
- Completely replace controllers/Application.scala (change the Recipient and From email addresses):
6. Start Play. Point your favourite web browser at http://localhost:9000/email
Your browser should say Hello.
Check your email.
You should have a new email, with a subject of “mailer” :O)
More information is available from https://github.com/playframework/play-mailer