Search code examples
htmlcssemailhtml-emailvelocity

Velocity mails with header and footer


We have hundreds of copied mails all written in Velocity, but they are all based on the same design so I need an effective way to deal with headers and footers. Today every email is just copied from a template file and if I need to change something it's search and replace, and then pray that it'll catch it all.

I'm an absolute noob when it comes to Velocity, since I'm a designer so wanna know some expert ideas. But I have a few musts:

1) I must be able to preview the result while editing. Now I'm previewing in a browser, but it doesn't need to be in a browser. I just need to be able to see and make changes. Because of this I cannot just include a header and footer from other files since when I preview the mail the HTML and CSS isn't there. I must see what I'm designing in other words.

2) I want the header and footer to be the same everywhere. So I can change those and it ripples down to every mail. Then every email just handles the content.

Any pro-ideas?


Solution

  • Currently there is no option to view online velocity templates, but you can use tool as JMeter JSR 223 element to execute velocity templates on HTTP level. - you will have to velocity core 2 jar which support JSR223.

    You should create header.vel and footer.vel and add include statement in your templates. For example:

     #include( "header.vel" )
     your template code....
     #include( "footer.vel" )