Skip to content Skip to sidebar Skip to footer

Making Newsletter(html) With Springframework3

I am sending newsletter like below with Springframework 3. private void sendMail(Map mailInfo) throws Exception{ JavaMailSenderImpl mailSender = new JavaMa

Solution 1:

You cant include your external css like you do normally , but you can prefer the way of wrapping the styles in the inline way (in <head> tag). So something like this,

<style>
.bigFont{
font-size:14px;
}
<style><body><pclass='bigFont' >Hi , i am bigger </p></body>

so this looks separate instead adding style attribute to your tags , you can also avoid some code by resusing .

AFAIK , for adding inline images Spring framework has very good documentation. It is supported widely by mail clients, an example,

FileSystemResourceres=newFileSystemResource(newFile("c:/Sample.jpg"));
helper.addInline("identifier1234", res);

so that you can simply use it as <img src='cid:identifier1234'>.

For advanced templating options you can integrate your web app with Apache velocity, a templating library

Post a Comment for "Making Newsletter(html) With Springframework3"