BodyFormat Property (CDONTS NewMail Object)
BodyFormat Property (CDONTS NewMail Object)
The BodyFormat property sets the text format of the NewMail object. Write-only.
Syntax
objNewMail.BodyFormat
Data Type
Long
Remarks
BodyFormat can contain exactly one of the following values:
BodyFormat setting |
Value |
Description |
CdoBodyFormatHTML |
0 |
The Body property is to include Hypertext Markup Language (HTML). |
CdoBodyFormatText |
1 |
The Body property is to be exclusively in plain text (default value). |
Example
This code fragment shows the usage of the BodyFormat property in preparing and sending an HTML message:
Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
HTML = HTML & "<title>Sample NewMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body>"
HTML = HTML & "This is a sample message being sent using HTML. <BR></body>"
HTML = HTML & "</html>"
myMail.From = "user2@example.com"
myMail.To = "user@example.com"
myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing