Alternate templates with Mail engine
I recently downloaded the excellent package Mail Engine from Tim’s blog. This package rocks. One issue I had was being able to have an alternate template for the newsletter im sending out. A newsletter template with minimal furniture would be ideal. However the current version of mail engine does not support alternate templates. So I did the following:
- Created newsletters doctype with one property umbracoNaviHide (true/false)
- Created newsletter doc type with one property with alias sourceNode and type content picker.
- Created a node of type newsletters in the root of the site
- Created a node of type newsletter in newsletters (step 3) and picked the document I wanted to email using the content picker
- Added XSLT macro called GetContentForEmail that i created which has the following code
<xsl:if test="$currentPage/data[@alias='sourceNode']!='' and umbraco.library:QueryForNode($currentPage/data[@alias='sourceNode'])"> <xsl:value-of select="umbraco.library:GetItem($currentPage/data[@alias='sourceNode'], 'bodyText')" disable-output-escaping="yes"/> </xsl:if>
- Created template for newsletter that uses macro from step 5 and in head tag added style tag with styles for formatting the page
I then sent this page as an email. Bascially now works like ultrasimple mailer used to.
Advertisement

Following on to this post, http://analytics.blogspot.com/2009/03/tips-for-tracking-email-marketing.html suggested by Soren Sprogge. You could onto the data type add the tracking parameters as part of the link to the actual page in the template, this will then in google give you some nice metrics on success of the newsletter.
Ismail
I needed to make some customisations to the way MailEngine works for a project I was working on. Tim was kind enough to share the source and I made an amendment to allow end-users to select from the allowed templates supported by the node to be emailed this allowed a specific email template to be used when mailing out a node. A different approach with the same goal.
Good idea about the Google Tracking links!
Nice, I think the MailEngine was great. For a project I was working on, I needed to have a specific email sent out when the client created a type of page. Umbraco and the MailEngine were perfect for this. It allowed me to basically create a node with pre-styled documents as emails which would then be sent out based on a specific action. Much like how triggers work in SQL. Will post a package or the code and a demonstration sometime in the future.
Great work guys, viva l’umbraco!!!
[...] Alternate templates with Mail engine April 20093
comments [...]
2010 in review « Ismail’s umbraco adventures said this on January 2, 2011 at 9:09 am |