EmailMessage
Class EmailMessage

The EmailMessage class is used in conjunction with SMTPSocket to send and receive email.

PropertyDescription
Dim Attachments() As EmailAttachmentArray of attachments to this message


Method DeclarationDescription
Sub Constructor()Initialize an empty message
Function BCCAddress() As Stringget BCC addresses, as a comma-delimited list
Function BodyEnriched() As Stringget the message body in "enriched" format
Sub BodyEnriched( Assigns newValue As String )set the message body in "enriched" format
Function BodyHTML() As Stringget the message body in HTML format
Sub BodyHTML( Assigns newValue As String )]set the message body in "enriched" format
Function BodyPlainText() As Stringget the message body in plain text format
Sub BodyPlainText( Assigns newValue As String )set the message body in plain text format
Function CCAddress() As Stringget the CC addresses, as a comma-delimited list
Function FromAddress() As Stringget the sender address
Sub FromAddress( Assigns newValue As String )set the sender address
Function Headers() As EmailHeadersget the message headers
Function Source() As Stringget the complete raw message source
Function Subject() As Stringget the message subject
Sub Subject( Assigns newValue As String )set the message subject
Function ToAddress() As Stringget the recipient addresses, as a comma-delimited list
Sub AddBCCRecipient( recipient As String )add a BCC recipient
Sub AddCCRecipient( recipient As String )add a CC recipient
Sub AddRecipient( recipient As String )add a normal ("To") recipient


When creating a new EmailMessage, you should always assign at least the FromAddress, Subject, and BodyPlainText, and add at least one recipient (via AddRecipient). If you want to send styled email, you can also assign to BodyHTML or BodyEnriched, but it is recommended to always include BodyPlainText for email clients that can't (or refuse to) display styled mail.

If you add any attachments, the email message will automatically be sent in multi-part MIME format.