Plain text email

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Plain text email

Michal Kreuzman
Hi,

it is possible to send plain text email and use Thymeleaf as template engine?
Reply | Threaded
Open this post in threaded view
|

Re: Plain text email

Zemi
Administrator
Yes, look at the documentation
   http://www.thymeleaf.org/documentation.html

Download the "Rich HTML email in Spring with Thymeleaf" sources zip and you'll find an example.
Reply | Threaded
Open this post in threaded view
|

Re: Plain text email

Michal Kreuzman
As you point it's "Rich HTML email" but I'm asking about "Plain text email" variant...
Reply | Threaded
Open this post in threaded view
|

Re: Plain text email

Zemi
Administrator
Plain text is a almost particular case of HTML :-)

You can use the same technique and, at the end, send only the contents inside the <body> tag (for example).

Just add a FragmentSpec the invocation to TemplateEngine.process() line:
   http://www.thymeleaf.org/apidocs/thymeleaf/2.0.11/org/thymeleaf/TemplateEngine.html#process%28java.lang.String,%20org.thymeleaf.context.IContext,%20org.thymeleaf.fragment.IFragmentSpec%29

All other code is almost the same as described in the documentation
   http://www.thymeleaf.org/springmail.html
Reply | Threaded
Open this post in threaded view
|

Re: Plain text email

Michal Kreuzman
Thank you this should do the job ;)