The BodyFormat property sets the text format of the NewMail object. Write-only.
objNewMail.BodyFormat
Long
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). |
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"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "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 = "Example@Microsoft.com"
myMail.To = "Someone@Company.com"
myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing