The ParseBody method sets the properties of an e-mail message object based on the body of an MSMQ mail message.
object.ParseBody varBody
Syntax Element | Description |
---|---|
object | E-mail message (MSMQMailEMail) object that defines the e-mail message. |
varBody | Variant type (array of bytes) body of an MSMQ mail message. |
The body of the MSMQ mail message is formatted in MSMQ Mail format.
This example defines an e-mail message object, composes the body of a mail message, and parses the message body into a second e-mail object and displays its subject.
To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, run the example, and click the form.
Dim email1 As New MSMQMailEMail
Dim email2 As New MSMQMailEMail
Dim msg As New MSMQMessage
Private Sub Form_Click()
'*********************
'* Define e-mail
'*********************
'Set e-mail type as form.
email1.ContentType = MSMQMAIL_EMAIL_FORM
'Set who receives the e-mail.
email1.Recipients.Add "RecipientName", "RecipientQueueLabel", MSMQMAIL_RECIPIENT_TO
'Set who sent the e-mail.
email1.Sender.Name = "Our name"
email1.Sender.Address = "Our queue label"
'Set the subject of the e-mail.
email1.Subject = "Test mail."
'**********************
' Define the form.
'**********************
'Set the form name.
email1.formdata.Name = "Test Form"
'Set single field of form
email1.formdata.FormFields.Add "Field1", "Field1 text."
'******************************
'Compose the mail message Body.
'******************************
msg.Body = email1.ComposeBody
'*********************
'Parse message Body as
'new e-mail object.
'*********************
email2.ParseBody msg.Body
'*****************************************
'Display the subject of new e-mail object.
'*****************************************
MsgBox "The subject of the new mail is: " + email2.Subject
End Sub
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Import Library: Included as a resource in mqmailoa.dll.
Unicode: Defined only as Unicode.
Add, Address, Body, ComposeBody, ContentType, FormData, FormFields, MSMQMailEMail, MSMQMessage, Name, Recipients, Sender, Subject