Skip to content

Body


Overview

The Body property allows you to set and retrieve the plain text content of an email message. When set, it automatically changes the BodyFormat to olFormatPlain.

Syntax

vba
' To set the Body
mailItem.Body = "Your plain text message"

' To get the Body
messageText = mailItem.Body

Return Value

A String value containing the body of the MailItem.

Example

vba
Sub BodyExample()
    Dim app As New nlsMailer.Application
    Dim mailItem As Object

    ' Create a new mail item
    Set mailItem = app.CreateItem(olMailItem)

    ' Set plain text body
    mailItem.Body = "Hello,

This is a simple plain text email message.

Best regards,
Your Name"

    ' Verify body content
    Debug.Print mailItem.Body

    ' Check body format (automatically set to plain text)
    Debug.Print mailItem.BodyFormat ' Outputs: olFormatPlain

    ' Append text to existing body
    mailItem.Body = mailItem.Body & vbNewLine & "P.S. This text was appended."
End Sub