sending some emails synchronously

50 views
Skip to first unread message

Tomas

unread,
Oct 16, 2011, 4:53:18 PM10/16/11
to play-framework
The documentation lacks info about a/sync behaviour of sending emails,
but I figured out that mails are sent according to Mail.public static
boolean asynchronousSend = true flag. How can I send the flag when I
want to send some emails synchronously but keep the rest of emails
async? Or is there any workaround?

Sebastien Cesbron

unread,
Oct 17, 2011, 4:42:55 AM10/17/11
Hi

Send method returns a Future so If you do

Future<Boolean> future = send(...);
Boolean result = future.get(); // Here you wait for the execution

you will wait until send is done and you get the result

Regards
Seb

2011/10/16 Tomas <[email protected]>

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.


Alexander Reelsen

unread,
Oct 17, 2011, 5:21:08 AM10/17/11
Hi

Sebastien Cesbron wrote:
> Hi
>
> Send method returns a Future so If you do
>
> Future<Boolean> future = send(...);
> Boolean result = future.get(); // Here you wait for the execution

just use sendAndWait() method instead of send()


--Alexander

Tomas

unread,
Oct 17, 2011, 6:25:15 AM10/17/11
to play-framework
Thanks
Reply all
Reply to author
Forward
0 new messages