play-plugins
play-plugins copied to clipboard
How to get EmailException
The MailerAPI send() method returns void and doesn't declare any exceptions. Apparently internally there is a Future somewhere and a EmailException, but I don't get that. All I get is a log entry in my log file saying
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:465
Now I need to be able to detect this so that I can do whatever (retry, use a fallback mail server, escalate the exception). Also, there is another open issue where someone asks how to test the mailer in a unit test.
I guess I have to use the commons mailer (or whatever package) directly for now.
@fabiankessler could you please test with the latest version ?
We are using email.send()
method from commons-email in here:
https://github.com/typesafehub/play-plugins/blob/master/mailer/src/main/scala/com/typesafe/plugin/MailerPlugin.scala#L398