Open ggrossetie opened 9 years ago
Maybe we could implement a reactive mail client? :wink:
or just name the method sendReactive()
to give the feeling of reactive :smile:
:+1: for the reactive mail client :)
@jroper could you explain what you have in mind ? Provide an implementation of http://www.reactive-streams.org/ ? Rely on Akka for async ? Replace commons-mailer with X ?
Thanks :)
Definitely not provide an implementation of reactive streams. However, we could use Akka streams to implement an asynchronous SMTP client - SMTP is mostly line by line so would be quite simple to parse and implement. But, I was 90% joking - I don't want to maintain an SMTP client.
I was 90% sure you were joking :smile: And what do you think about the initial proposition (i.e. using Akka to schedule the send) ? This is a simple (and maybe dumb solution) but then users can compose futures (using other Play! libraries like WS).
You could also just do:
Future(...)
That will dispatch it asynchronously, and also allow you to add callbacks when it's done.
@jroper even if it sounds aweful but I think maintaining a akka-mail client has benefits.
Also we wouldn't need to provide a SMTP Mailer, we could drop apache-commons Mail and just use javax.mail (which apache-commons uses internally) we would just drop a dependency that only gives a "nicer" API. But that happens only internally so, the benefit is definitely there by dropping yet another dependency. And Akka is mostly there anyway.
When I send an email I don't want to "block" my process. I'm using Akka to "schedule" the send:
Maybe we can add a
sendAsync
to the API to do that ? or just an example in the documentation ? And it might be better to return aFuture
?