Sending Messages with Html and Text body

You may want to send messages to recipient in text AND HTML format, so that they can read the content even if the Mail reader is not HTML capable.

LOCAL loSMTP as wwSmtp
* loSmtp.nMailMode = 2  && wwIPStuff mode (Win32)   0 - .NET wwSmtp

loSmtp.cSenderName="Rick Strahl"

loSmtp.cSubject="wwIPStuff Test Message"

*** Set up Messages - first part is the most desirable content type
loSmtp.cMessage="<b>This is the HTML message text</b>"
loSmtp.cContentType = "text/html"

*** Second part is plain text as fallback
loSmtp.cAlternateText = "This is the plain message text"
loSmtp.cAlternateContentType = "text/plain"

llResult = loSmtp.SendMail()      
IF !llResult
   Wait window loSmtp.cErrorMsg

cContentType determines the content type of the main message, while cContentTypeAlternate applies to the alternate content. It's recommended that you your most desirable content type first because that's what the mail client looks for first - it goes down the list and uses the first it knows how to handle.

Please note that you can't use file attachments in this mode when using nMailMode=2 (wwipstuff.dll).

© West Wind Technologies, 1996-2024 • Updated: 01/13/2016
Comment or report problem with topic