Tuesday, November 06, 2007

New Feature: Generating a Plain Text Message Automatically at Run-Time

You can now have JangoMail automatically generate a Plain Text version of your e-mail message, based on your HTML version, at the time the email message is sent (run-time). To do this, set your Plain Text message to the word "auto-generate".

There has always been the "Set Plain Text Automatically" button underneath the Plain Text Message field on the Send Email page. This button examines your HTML message and generates a Plain Text Message for you right before your eyes. However, there may be situations where you don't want to generate the Plain Text message right away but rather have the Plain Text message generated at the time the email message is actually sent.

There are 3 scenarios where this feature will be advantageous.

Scenario 1 - Embedded URLs

If you are using Embedded URLs within your e-mail message, your HTML message might look like:

<html>
<p>
Hello there.  Below you will find today's mutual fund prices:
</p>
[%%http://www.MutualFundCompany.com/Prices.aspx%%]
<p>
Thank you for investing in our mutual funds.
</p>
</html>


By setting the Plain Text Message field to "auto-generate", the following will take place at the time of e-mail sending:

  1. JangoMail will retrieve the HTML content from the specified URL.
  2. JangoMail will insert the HTML content into the HTML message.
  3. JangoMail will generate a Plain Text version of the e-mail message based on the complete HTML message.

In this scenario, if you do NOT set the Plain Text field to "auto-generate", but instead use the "Set Plain Text Automatically" button on the Send E-mail page, the following will take place:

  1. The Plain Text version will look like this:

    Hello there. Below you will find today's mutual fund prices.

    [%%http://www.MutualFundCompany.com/Prices.aspx%%]

    Thank you for investing in our mutual funds.
  2. When JangoMail retrieves the HTML content from the URL, the Plain Text message will now contain HTML code, and we don't want that to happen!

Scenario 2 - Using the Web Service/API

When calling any of these methods:

SendMassEmail
SendMassEmailPrevious
SendMassEmailRaw

Setting the MessagePlain input parameter to "auto-generate" will allow JangoMail to generate a Plain Text version of your HTML e-mail for you automatically. The "Set Plain Text Automatically" button that is available in the JangoMail web interface is not available when using the API, so for any automatic conversion to take place, the MessagePlain input parameter must be set to "auto-generate". Otherwise, you would have to manually input a Plain Text version of your message.

Scenario 3 - Using Conditional Logic Statements

When using VBScript conditional logic statements in your e-mail message, the line spacing of plain text messages can be altered based on where you place your lines of code. These spacing issues can be avoided by setting the Plain Text field to "auto-generate" rather than placing actual conditional logic statements within the Plain Text field.