I am using play-framework 2.3.x
and scala 2.11.4
. When integrate play-mailer
for sending and emails from my application, there is nothing happen. In the logs there are no exception produces and no return values are available. Following is email properties:
smtp.host = "smtp.gmail.com"
smtp.port = 25
smtp.user = "n****@gmail.com"
smtp.password = "*******"
smtp.debug = true
smtp.mock = true
My Scala Code:
Future{
var subject = "Invitation email";
var from = "h****@gmail.com";
var to = userList.map { user => user.email }.seq;
var email: Email = new Email(subject, from, to);
CustomUtility.sendEmail(email)
}
I need to send my all emails to async
task. My CustomUtility
method :
def sendEmail(email: Email){
var message = MailerPlugin.send(email);
println("MESSAGE >>>>>>>>>>>>>>>>>>>>>>>>>> : "+message);
}
Update
The major problem is that, i am not receiving an emails
I think that you need to make this changes from the sample code play mailer
firts add the file /conf/play.plugins with the content:
Second you configuration in application.conf must be:
and the controller sending your code this, yo do need to use futures as I follow the example in the github repository
You can use this code inside an asyn task like async
for an asyncronus methos in a controller
do not forget to add this import
If you want to use scala Futures in your action I recommend that use this code
imports:
the method is:
and your CustomUtility
package controllers
and my user class just for the sample
I hope that your user class and user list works with your code if not please write them. I hope this works. I always recommend this entry in Alvin Alexander Blog for using futures: http://alvinalexander.com/scala/scala-future-semantics