[2.0.1-java] Best way to send emails

Showing 1-13 of 13 messages
[2.0.1-java] Best way to send emails abhishek 7/23/12 3:34 AM

Hi

Is there a good way to send emails, i have seen the following module, https://github.com/typesafehub/play-plugins/tree/master/mailer , but i am not happy with it, as it will need me read the template file and replace variables in template and then send email.

 

I will need a better solution which will not need me read the file via my code. Is it possible in play java 2.0.1 ?

 

Thanks

Abhishek jain

Re: [2.0.1-java] Best way to send emails iammichiel 7/23/12 8:03 AM
And what exactly do you need? Because I do not think there is any better solution then the one provided by Typesafe here. 

> It will need me read the template file.

What do you mean by that? 
Re: [2.0.1-java] Best way to send emails abhishek 7/23/12 9:31 AM


On Monday, July 23, 2012 8:33:07 PM UTC+5:30, iammichiel wrote:
And what exactly do you need? Because I do not think there is any better solution then the one provided by Typesafe here. 


I will prefer something like  for scala at link
https://github.com/taraxe/mail-plugin#readme
 
> It will need me read the template file.

What do you mean by that? 
Instead of reading the file from the filesystem , i will prefer like
mail.sendHtml(views.html.viewName.render(b) );

which don't work here for me.

thanks
abhishek

Re: [2.0.1-java] Best way to send emails Ronald Haring 7/23/12 11:26 AM
Did you try with:
mail.sendHtml(views.html.viewName.render(b).body())

The views.html.viewName.render(b).body() will return the html content of the page. That might work I think

Gr
Ronald
Re: [2.0.1-java] Best way to send emails MG 7/23/12 1:36 PM
Why not just use the Apache Commons Email directly?

-MG,
www.trustrecs.com
Re: [play-framework] Re: [2.0.1-java] Best way to send emails iammichiel 7/24/12 12:15 AM
The typesafe mailer plugin is nothing more than a scala adapter of the apache-commons library. All code under the hood is apache-commons.


> libraryDependencies += "org.apache.commons" % "commons-email" % "1.2", 

2012/7/23 MG <mohamme...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/HHY468TeI9IJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Re: [play-framework] Re: [2.0.1-java] Best way to send emails iammichiel 7/24/12 12:17 AM
And as second answer, you can call toString directly after the render method. 


mail.send(
views.txt.helpers.mail.inscription().toString,
views.html.helpers.mail.inscription().toString
)


2012/7/24 Michiel Missotten <missotte...@gmail.com>

Re: [play-framework] Re: [2.0.1-java] Best way to send emails MG 7/28/12 2:31 PM
I am not sure what is the benefit of using the scala adapter instead of using commons email directly. The commons email api is pretty straight forward and it took me almost the same time to learn how to use the TypseSafe Mailer as time to learn Commons Email API. So I am curious what is the benefit of the Typesafe scala adapter.

BTW, I am using the Commons Email from a Scala app.

-MG


On Tuesday, July 24, 2012 12:15:12 AM UTC-7, iammichiel wrote:
The typesafe mailer plugin is nothing more than a scala adapter of the apache-commons library. All code under the hood is apache-commons.


> libraryDependencies += "org.apache.commons" % "commons-email" % "1.2", 

2012/7/23 MG
Why not just use the Apache Commons Email directly?

-MG,
www.trustrecs.com

On Monday, July 23, 2012 3:34:10 AM UTC-7, abhishek wrote:

Hi

Is there a good way to send emails, i have seen the following module, https://github.com/typesafehub/play-plugins/tree/master/mailer , but i am not happy with it, as it will need me read the template file and replace variables in template and then send email.

 

I will need a better solution which will not need me read the file via my code. Is it possible in play java 2.0.1 ?

 

Thanks

Abhishek jain

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/HHY468TeI9IJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Re: [2.0.1-java] Best way to send emails Ronald Haring 7/29/12 6:51 AM
I think the benefit is that you can :
- use the same view that you use to show a page to a user, so you can mail that page as well
- since it uses the template, it will be type safe so no runtime exceptions when trying to mail

The only thing that I find missing is the default mockmail implementation of play 1. I wonder how I can emulate that?

Regards
Ronald
Re: [2.0.1-java] Best way to send emails peter hausel 7/29/12 11:54 AM
Re: [2.0.1-java] Best way to send emails MG 7/29/12 3:54 PM
I am not following your train of thought. What does a view have to do with email API?
Re: [2.0.1-java] Best way to send emails Ronald Haring 7/30/12 10:08 AM
ah great, thx Peter

@MG, well you will gain the type safety compilation of your message, so you can add parameters in your template which will be type safe. e.g.
Hello @user.firstname

glad you sent us an email concerning @subject. We will look into it right away

This can be a view for rendering on a html page but also for an email

Regards
Roald
Re: [2.0.1-java] Best way to send emails MG 7/30/12 3:36 PM
Ah, I see. Thanks for the elaboration. However, I think that rendering an email using a template is separate task; independent of the api used for sending it . One could use a view to render a custom email from a template and then pass the custom email to the commons email api.

Am I missing something?

-MG