[2.0-scala] EmailException: Sending the email to the following server failed : smtp.gmail.com:587

14,861 views
Skip to first unread message

abond

unread,
Aug 20, 2012, 5:21:39 AM8/20/12
to play-fr...@googlegroups.com
Hello!

I'm trying to send email through mailer-plugin.
add "com.typesafe" %% "play-plugins-mailer" % "2.0.4" to my dependencies (project/Build.scala),
add parameters to conf/application.conf
And I get error:
EmailException: Sending the email to the following server failed : smtp.gmail.com:587

Can anyone help?


MG

unread,
Aug 26, 2012, 1:09:09 AM8/26/12
to play-fr...@googlegroups.com
did you make sure that the username and password you provided is correct? In addition, gmail requires SSL to be enabled.

-MG

Myyk

unread,
Oct 2, 2012, 7:24:59 PM10/2/12
to play-fr...@googlegroups.com
I'm having a similar problem, I think.  Here is some more information.  I'm afraid I don't have the certificates to talk to Gmail.  Could someone help by letting me know how you have connected to Gmail's SMPT servers over SSL?

This is what is in my application.conf:

smtp.mock=false
smtp.host=smtp.gmail.com
smtp.port=465
smtp.ssl=true
smtp.user="f...@gmail.com"
smtp.password=bar

I'm seeing an stack like this:

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[EmailException: Sending the email to the following server failed : smtp.gmail.com:465]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.2]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.2]
at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.2]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:465
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:241) ~[play-plugins-mailer_2.9.1-2.0.4.jar:2.0.4]
at controllers.Application$$anonfun$index$1.apply(Application.scala:21) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:8) ~[classes/:na]
at play.api.mvc.Action$$anonfun$apply$4.apply(Action.scala:204) ~[play_2.9.1.jar:2.0.2]
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]

I hope someone is able to help. Thanks in advance!

Myyk

Monteiro

unread,
Oct 2, 2012, 7:29:08 PM10/2/12
to play-fr...@googlegroups.com

smtp.ssl=yes (you have true :-) )

Did it worked?

Myyk

unread,
Oct 2, 2012, 7:41:23 PM10/2/12
to play-fr...@googlegroups.com
I changed smtp.ssl=true to smtp.ssl=yes.  I got the same error.

I'm working from Play 2.0.2 with on Ubuntu 12.04 LTS workstation.  (Thanks for you fast response Monteiro)

Monteiro

unread,
Oct 2, 2012, 7:47:33 PM10/2/12
to play-fr...@googlegroups.com
No prob, 

I use the following configuration on my Applications:

smtp.host=smtp.gmail.com

smtp.port=465

smtp.ssl=yes

smtp.user="myemail@gmail.com"

smtp.password=mypassword

You can try stop the application and start again so see if it works.

Myyk

unread,
Oct 2, 2012, 7:51:49 PM10/2/12
to play-fr...@googlegroups.com
Yeah, so I stopped the application and started it a few times and it still isn't going.  Are you using a keystore?  Also are you running it with "play run"?  I'm working on packaging up something for GitHub so that maybe I can share a working example with the world at the end of this.

Monteiro

unread,
Oct 2, 2012, 7:55:57 PM10/2/12
to play-fr...@googlegroups.com
Try to access the gmail email from which you're using as smtp to verify if it is not the password.

Because it says:

Caused by: javax.mail.AuthenticationFailedException: null (that seems like an authentication problem)

I'm not using a keystore. Yes, I'm using play run. 
I'm using Mail plugin from typesafe. ( "com.typesafe" %% "play-plugins-mailer" % "2.0.4" )

Segunda-feira, 20 de Agosto de 2012 10:21:39 UTC+1, abond escreveu:

Myyk

unread,
Oct 2, 2012, 8:10:10 PM10/2/12
to play-fr...@googlegroups.com
Wow!  Yeah, that was the issue.  I have 2 gmail accounts, I just used the other one and it worked.  Thanks a lot.  Here is my code for anyone else that might need it.

Reply all
Reply to author
Forward
0 new messages