JSP as email template

Is there a way to send a MIME email in which the body of the email is received from the JSP? I need to send an email with Javamail that contains a table, and I find it would be convenient if I could use JSP to do all the formatting and layout.

+7
java email jsp
source share
3 answers

In this topic Offers for Java Email Templating , buddy Jack Leo talks about how he did it using JSP / Servlet. This can be of any help.

+6
source share

For this, I think that you basically need a Tomcat server (or equivalent), and when creating the email, send a request to the server to call your JSP, which will then send back the email content (or the HTML part of the email) as an answer. However, it is not very elegant.

You will probably be better off with a separate template system. Here is an interesting answer from the corresponding question.

(shameless plugin: I like Clearsilver as a template system if you are on UNIX / Linux)

+3
source share

It's complicated. I would suggest you use Velocity.

It is somehow similar to JSP, but it was created for autonomous work.

Unfortunately, I do not have many resources where I can redirect you.

Here's what might seem interesting:

http://www.martinfowler.com/bliki/JRubyVelocity.html

+3
source share

All Articles