Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 251
Product
SMTPmail
Version
2.x
Title
HOWTO: Create mixed body content in one email
Problem
With SMTPmail, it is possible to set content in both HTML and plain text. Depending on the capabilities/settings of the email client, the appropriate content type will be used.
Solution
Some mail clients are capable of accepting mail message bodies formatted in HTML whereas some are capable of plain text only. As the sender, it is typically not feasible to know which client supports what content type. With SMTPmail, it is possible to set the mail body in both plain text and HTML so the appropriate content type will be used by the type each client supports.

There are two ways to do this:
  1. Setting both the HTMLText and BodyText properties
  2. Setting both the GetHtmlTextFromFile and GetPlainTextFromFile properties.
Option One

<%
Set mailer = Server.CreateObject("SoftArtisans.SMTPmail")


mailer.HTMLText ="<b>This is</b> HTML content<br>" mailer.BodyText = "I am plain text" & vbCRLF


Option Two
mailer.GetHtmlTextFromFile "c:\email\HtmlBodytext.htm" mailer.GetPlainTextFromFile "c:\email\PlainBodytext.txt" %>


Note: GetPlainTextFromFile and GetHtmlTextFromFile methods are not available in SMTPMail Free version.

It is not necessary to set the ContentType property. The content-type of mixed body type will be automatically set to multipart/alternative.
Created : 5/16/2003 10:22:38 AM (last modified : 5/16/2003 10:22:41 AM)
Rate this article!
Comments