Java Email Templates with UI? -


my website, built in java/jsp, need send 5-10 predefined emails , adhoc emails registered. i'm looking avoid 'reinventing wheel'. i'd prefer if email templates managed wysiwyg type of gui. far i've read (velocity, freemarker, etc) ok predefined templates, don't have ui , don't adhoc emails.

just curious best off writing myself or there out there can help?

why need gui craft emails? best keep email content simple possible instead of embedding html tags in it. if user decides open email plain/text, see bunch of ugly tags.

using template engine such velocity or freemarker way go craft email template. adhoc emails, may want keep header , footer same using email template , can swap out body content adhoc messages.

in project, have email template using velocity, this:-

exception-email.vm file

** please not reply message **  project administrator has been notified regarding error. remote host : $remotehost server      : $servername request uri : $requesturi user id     : $currentuser exception   :   $stacktrace 

to constructed email string, following:-

private string getmessage(httpservletrequest request, throwable t) {     map<string, string> values = new hashmap<string, string>();     values.put("remotehost", request.getremotehost());     values.put("servername", request.getservername());     values.put("requesturi", request.getrequesturi());     values.put("currentuser", ((currentuser != null) ? currentuser.getlanid() : "(user undefined)"));      stringwriter sw = new stringwriter(500);     t.printstacktrace(new printwriter(sw));      values.put("stacktrace", sw.tostring());      return velocityengineutils.mergetemplateintostring(velocityengine, "exception-email.vm", values); } 

granted, i'm using spring wire in velocityengine:-

<bean id="velocityengine" class="org.springframework.ui.velocity.velocityenginefactorybean">     <property name="velocityproperties">         <props>             <prop key="resource.loader">class</prop>             <prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.classpathresourceloader</prop>         </props>     </property> </bean> 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -