[2.0] play framework plugin mailer on heroku

692 views
Skip to first unread message

Hugo Alves

unread,
Jul 28, 2012, 6:37:22 AM7/28/12
to play-fr...@googlegroups.com
currently i'm using this plugin  https://github.com/typesafehub/play-plugins/tree/master/mailer and haven't had any trouble with it on the localhost. but as soon as i push it to heroku it give me this annoying error:

  Internal server error, for request [POST /mobile/newUser] ->

  play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[EmailException: Sending the email to the following server failed : smtp.gmail.com:587]]
   at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1-2.0.1.jar:2.0.1]
   at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1-2.0.1.jar:2.0.1]
   at akka.actor.Actor$class.apply(Actor.scala:311) [akka-actor-2.0.1.jar:2.0.1]
   at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1-2.0.1.jar:2.0.1]

   at akka.actor.ActorCell.invoke(ActorCell.scala:619) [akka-actor-2.0.1.jar:2.0.1]

   at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:196) [akka-actor-2.0.1.jar:2.0.1]
  Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:587
   at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242) ~[commons-email-1.2.jar:1.2]
   at org.apache.commons.mail.Email.send(Email.java:1267) ~[commons-email-1.2.jar:1.2]
   at com.typesafe.plugin.CommonsMailer.send(MailerPlugin.scala:224) ~[play-plugins-mailer_2.9.1-2.0.2.jar:2.0.2]
   at com.typesafe.plugin.CommonsMailer.send(MailerPlugin.scala:188) ~[play-plugins-mailer_2.9.1-2.0.2.jar:2.0.2]
   at controllers.MobileController.newUserPost(MobileController.java:62) ~[connectlabweb_2.9.1-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
   at Routes$$anonfun$routes$1$$anonfun$apply$3$$anonfun$apply$4.apply(routes_routing.scala:244) ~[connectlabweb_2.9.1-1.0-SNAPSHOT.jar:na]
 Caused by: javax.mail.AuthenticationFailedException: null
   at javax.mail.Service.connect(Service.java:319) ~[mail-1.4.1.jar:1.4.1]
   at javax.mail.Service.connect(Service.java:169) ~[mail-1.4.1.jar:1.4.1]
   at javax.mail.Service.connect(Service.java:118) ~[mail-1.4.1.jar:1.4.1]
   at javax.mail.Transport.send0(Transport.java:188) ~[mail-1.4.1.jar:1.4.1]
   at javax.mail.Transport.send(Transport.java:118) ~[mail-1.4.1.jar:1.4.1]
   at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232) ~[commons-email-1.2.jar:1.2]

Any ideas why this is happening

here's what is in my application.conf:
# ~~~~~
# Mailer
smtp.host=smtp.gmail.com
smtp.port=587
smtp.ssl=true
smtp.user="<email>"
smtp.password=<password>

keep in mind that this configs worked fine in localhost so password email or host are not wrong.

ty for any help on this matter. Heroku is really driving me crazy, first 1 week lost because of db configs and deployment now another because of mailer configs :\


Nilanjan

unread,
Jul 28, 2012, 11:09:20 AM7/28/12
to play-fr...@googlegroups.com
I wonder whether you have to setup things at Procfile to make it work. Have you looked into this:

http://blog.flurdy.com/2012/05/send-email-via-sendgrid-on-heroku-using.html

Nilanjan
Message has been deleted

James Ward

unread,
Jul 28, 2012, 4:44:24 PM7/28/12
to play-fr...@googlegroups.com
It looks like there is something wrong with your auth setup.  I don't think there is anything on Heroku that would prevent this from working.

I've used the Mailer Plugin with the SendGrid add-on and it worked fine.  My config:
smtp.port=587
smtp.ssl=true
smtp.user=${SENDGRID_USERNAME}
smtp.password=${SENDGRID_PASSWORD}

Hope that helps.

-James

MG

unread,
Jul 28, 2012, 5:55:39 PM7/28/12
to play-fr...@googlegroups.com
I don't think this is a Heroku issue. I was able to get the TypeSafe mailer plugin working on Heroku by just following the instructions on the plugin's home page.

From the logs, it looks like the client is unable to authenticate with the Gmail server. I would double check that the smtp settings are getting correctly read in production mode when your app is running on Heroku. You could log them and see if they match with what you have when you run the application on the localhost.

-MG

Petre Angelovski

unread,
Jan 16, 2013, 7:15:55 AM1/16/13
to play-fr...@googlegroups.com
Hi MG,
Did you manage to find a solution for this?

MG

unread,
Jan 18, 2013, 5:31:16 PM1/18/13
to play-fr...@googlegroups.com
Solution for what? I didn't have any issue using the plugin.

MG

M. Kessir Adjaho

unread,
Mar 6, 2014, 11:57:12 PM3/6/14
to play-fr...@googlegroups.com
Hi Hugo,
were you able to solve this issue?

Hugo Alves

unread,
Mar 7, 2014, 4:30:23 AM3/7/14
to play-fr...@googlegroups.com
It's been a will ago. It was a school project at the time and i think we discarded the send mail option in the end due to the lack of time. Sorry not to be able to help :\
Reply all
Reply to author
Forward
0 new messages