开发者

Using Email Template in Spring

开发者 https://www.devze.com 2022-12-20 00:24 出处:网络
I am developing a small utility application emailafriend using Spring. The basic functionality is to email the current url to a friend. As of now I am using a fixed email template which I have hard co

I am developing a small utility application emailafriend using Spring. The basic functionality is to email the current url to a friend. As of now I am using a fixed email template which I have hard coded in the class something like -

StringBuffer buf = new StringBuffer(form.getSenderName());
buf.append(" want to look at this page: ").append("\n\n<");
buf.append("http://").append(host).append(form.getPageUrl()).append(">\n\n");
buf.append("Please click on the link above for more information.");
buf.append("\n\n");

But, the email templates can be changed frequently as per busine开发者_开发百科ss. Can I utilize spring for this purpose (or any other way), so that I don't have to the Java code again and again.


I suggest using a template engine such as Freemarker for this (or Velocity, but Freemarker is better, IMO). Spring provides support for these.

0

精彩评论

暂无评论...
验证码 换一张
取 消