EmailMessage
Class EmailMessage
The EmailMessage class is used in conjunction with
SMTPSocket to send and receive email.
| Property | Description
|
| Dim Attachments() As EmailAttachment | Array of attachments to this message
|
| Method Declaration | Description
|
| Sub Constructor() | Initialize an empty message
|
| Function BCCAddress() As String | get BCC addresses, as a comma-delimited list
|
| Function BodyEnriched() As String | get the message body in "enriched" format
|
| Sub BodyEnriched( Assigns newValue As String ) | set the message body in "enriched" format
|
| Function BodyHTML() As String | get the message body in HTML format
|
| Sub BodyHTML( Assigns newValue As String ) | ]set the message body in "enriched" format
|
| Function BodyPlainText() As String | get the message body in plain text format
|
| Sub BodyPlainText( Assigns newValue As String ) | set the message body in plain text format
|
| Function CCAddress() As String | get the CC addresses, as a comma-delimited list
|
| Function FromAddress() As String | get the sender address
|
| Sub FromAddress( Assigns newValue As String ) | set the sender address
|
| Function Headers() As EmailHeaders | get the message headers
|
| Function Source() As String | get the complete raw message source
|
| Function Subject() As String | get the message subject
|
| Sub Subject( Assigns newValue As String ) | set the message subject
|
| Function ToAddress() As String | get 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.