TABLE OF CONTENTS › Creating an HTML Email Template

Another type of template is for a “multi-part MIME email” — these are special emails that contain within themselves two versions, a text version and an html version. The email program of your subscriber decides which to display based on its own capabilities (and your subscriber’s preferences).

These emails are not much more difficult to send than standard text emails, with the help of the <txp:bab_pm_mime /> custom tag.

NOTE: There are any number of reasons why your emails won’t arrive to your subscriber’s inbox the way you want them to. For this reason I advocate Text vs. HTML emails. I do my best to help folks with HTML email questions, but I am not an expert.

Here’s the simplest example:

[placeholder for the “text warning”]

<txp:bab_pm_mime type="text" />

[placeholder for the text version]

<txp:bab_pm_mime type="html" />

[placeholder for the HTML version]

<txp:bab_pm_mime type="end" />

Notice how the <txp:bab_pm_mime type="text" /> tag precedes the text version, the <txp:bab_pm_mime type="html" /> tag precedes the html version, and then the <txp:bab_pm_mime type="end" /> tag ends the email. Also notice the “mime warning,” which precedes even the <txp:bab_pm_mime type="text" /> tag — this is text that will display if the subscriber’s email program can’t read multi-part MIME emails.

NOTE: Folks have been removing the closing “end” mime tag to get their emails to display properly in Gmail. I’m not sure what that does to other email readers, but seems to work.

So, you are going to want to replace [placeholder for the text version]with the text version, and [placeholder for the HTML version] with the HTML version (I also suggest replacing [placeholder for the "text warning"] with the text version). How do you do that?

You’ll use the Textpattern tags to pull different versions of the email into your newsletter template. Something like this would work:

<txp:excerpt />

<txp:bab_pm_mime type="text" />

<txp:excerpt />

<txp:bab_pm_mime type="html" />

<txp:body />

<txp:bab_pm_mime type="end" />

NOTE: In this example, put what you want in your text version in the Excerpt field of your article, and put the HTML in the Body field.

Now to get more complicated, say you want to customize your newsletters a little bit. Say, add your subscriber’s name. Something like this:

<txp:bab_pm_data display="subscriberName" />,

<txp:excerpt />

<txp:bab_pm_mime type="text" />

<txp:bab_pm_data display="subscriberName" />,

<txp:excerpt />

<txp:bab_pm_mime type="html" />

<p><txp:bab_pm_data display="subscriberName" />,</p>

<txp:body />

<txp:bab_pm_mime type="end" />

NOTE: In the HTML version, you have to wrap the salutation in <p> tags, because it’s HTML — without the <p></p> tags, everything would run together.

But our example is annoying — for each newsletter, you’ll have to type twice (once in the Body field, and once in the Excerpt field). Postmaster makes it easy to use the Body field in both places. Do it like this:

<txp:bab_pm_data display="subscriberName" />,

<txp:bab_pm_data display="Body" strip_html="yes" />

<txp:bab_pm_mime type="text" />

<txp:bab_pm_data display="subscriberName" />,

<txp:bab_pm_data display="Body" strip_html="yes" />

<txp:bab_pm_mime type="html" />

<p><txp:bab_pm_data display="subscriberName" />,</p>

<txp:body />

<txp:bab_pm_mime type="end" />

Back to the Table of Contents

Comment

good post

Baseball hats · May 4, 09:59 PM · #

I found very useful and interesting posts in this blog which is the great signs for a good blogger.

Medical Supplies · Dec 4, 02:09 AM · #

Here is the information is provided about the future of the books and really it is great issue and topic to discuss and it is nice to comment here.

Windows Hosting India · Dec 21, 11:57 PM · #

The information provided in this blog is really very interesting and easy to understand. It is nice to see this blog and it’s really informative for the readers.
Thank you.

dissertation help · Jan 31, 09:49 AM · #

Textile Help

Official Documentation for Postmaster (A Textpattern Plugin)

Get Postmaster

RELATED

REGULARS

DISCLAIMER

Postmaster is a plugin for Textpattern, and is licensed under the GNU GPL. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licens for more details.