how to code an email template in Sitefinity - General Discussions - General Discussions - Progress Community
 General Discussions

how to code an email template in Sitefinity

  • how to code an email template in Sitefinity
  • Hello..

    I would like to create a template for use as a newsletter email. I know
    that with HTML email, styles need to be inline, and layouts table-based.
    What I am trying to figure out is what this means for Sitefinity's
    email campaign tool. My client would like me to create a blank template
    that matches his website, and be able to edit the layout as needed using
    Sitefinity's CMS, meaning creating columns, adding content blocks, etc.
    From watching Sitefinity's video on email campaigns, this looks
    possible. What I don't understand though is first, whether or not
    Sitefinity will create tables instead of divs if the client uses the CMS
    to add columns, and whether I need to set up all inline styles in a
    Master file, or if Sitefinity can take a stylesheet and automatically
    create the inline styles for me. I was unable to find Sitefinity
    documentation on creating email templates, so any info is much

  • I'm rather surprised that no one answered this yet. All you have to do is create a master page in your App_Master folder that will be used for the email template. Then from the Sitefinity admin Email management area, click the 'base on template' option and browse to your master page. Obviously anywhere you need editable content you will have to put content placeholders.

    Hope this helps someone out there!
  • Hi Brian,

    i too am surprised no one has answered this further, maybe someone from Telerik outlining exactly the template creation steps would be good.

    Did you have success with the method you described as I lost all my styles when the email arrived in my Outlook when I followed that process.

  • The only way I've found to do it is to actually write inline styles into each piece of markup you need to style. Putting a style block in the head doesn't seem to work. IMHO, this is a flaw in the SF email functionality. As most email clients read the style block perfectly, I know gmail is one that doesn't though. Here's a small breakdown of email client support:

    Hope this helps!
  • Hi All,

     Christel is right as far as getting a masterpage to determine your template. You can see our documentation here on modifying the layout of the message template. Using the available CMS tools is absolutely appropriate for this situation. The same as you would for a page. I have never had a problem styling the email templates so if you want to attach your templates I can take a look at them and figure out what might be causing the problems.

    Kind regards,
    Patrick Dunn
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • I have the same problem as Darren - made a masterpage template, imported it into Sitefinity, styled it with a CSS theme that's also properly uploaded, and it all works fine in the Sitefinity editor. Made a nice newsletter for testing purposes, using the Content modules (click and drag). Then I sent it out to my own e-mail address (Outlook).

    The entire newsletter was messed up. The content was actually there so it did pick up the content modules (cPhPlaceholders in the masterpage). Things like text color and any CSS background images were applied, but the positioning of any divs was gone and everything was just sorted from top to bottom. 

    I realise the tin says "May not work on all e-mail clients" but Outlook is kind of a big one. It would be a shame if we can't use the full power of the Sitefinity mail client. Is there a way to make the template function properly in Outlook?
  • Using MasterPages and the page editor to design these is mostly useless if you are actually sending these things out. Email readers all have weird rules about what they will and will not accept. Patrick linked to THE resource for this kind of stuff.

    Your best bet is to design the template by hand in HTML. Keep in mind the campaign monitor rules (all styles are inlined, use tables for layout, no floats, no background images, etc.). In essence, you have to make it using HTML from about IE4 / IE 5.5 era days, and even then you have to take into consideration the individual quirks of Outlook, GMail, Yahoo mail, etc.

    Also, always include a text only version if possible. Good luck. Dealing with e-mail newsletters is a pain unlike most anything else.
  • Hello Bob,

     Each email client has its own restrictions for which elements and styles it accepts. The limitations of email campaign HTML is often why people resolve to image-heavy solutions. With that being said Sitefinity's support for these clients is independent. The layout generator works for all of them. Make sure in Outlook your email is trusted or else it won't fully load. Additionally please check this chart to make sure you are using valid markup for each client.

    I hope this helps.

    All the best,
    Patrick Dunn
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • I have not tried it, but I could see it being possible. You would have to make sure the base template is designed right, and then create new widget templates for each content module you wanted to use that is not based on some of those e-mail snafus. I believe that any old newsletters will always have the most recent content in them then though, regardless of what you ACTUALLY sent, but you may not care about that.

    Like I said, that guide is your best friend in this. Outlook is going to be your biggest headache, so if you can, test there first.
  • Thanks Patrick & Michael, for your replies. I'll try to recreate the template using HTML and inline styling only, with Patrick's guide as a .. guide ;-) Shouldn't be too difficult as I created the template by hand to begin with (typing out everything by hand, I like to work that way), so most of the styling is already there, just in CSS.

    Question though: Can I still use cPh's and the Sitefinity content modules as long as I style using tables and such, or is that a no-go as well?