The TextMessageData property defines a text message.
This property is only meaningful if ContentType is set to MSMQMAIL_EMAIL_TEXTMESSAGE.
Type: | MSMQMailTextMessageData |
Run time: | Read-write |
object.TextMessageData
Syntax Element | Description |
---|---|
object | E-mail message (MSMQMailEMail) object that defines the text message. |
MSMQMailTextMessageData object.
When composing the body of an MSMQ mail message that represents a text message, set ContentType to MSMQMAIL_EMAIL_TEXTMESSAGE.
When parsing the body of an MSMQ message, verify that ContentType is set to MSMQMAIL_EMAIL_TEXTMESSAGE before looking at TextMessageData. This property is empty if ContentType indicates another e-mail type.
This example defines an e-mail object as a text message, setting the text message body to "This is a text message". The e-mail object is then used to compose the body of a mail message, and a message box displays the text of the mail.
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 email As New MSMQMailEMail
Dim msg As New MSMQMessage
Private Sub Form_Click()
'***********************
'* Define e-mail object
'***********************
'Set e-mail type to text message
email.ContentType = MSMQMAIL_EMAIL_TEXTMESSAGE
'Add Recipients
email.Recipients.Add "Connector Recipient Name", "ExchangeUser@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_TO
email.Recipients.Add "MAPI Recipient Name", "MAPIUserInputQueueLabel", MSMQMAIL_RECIPIENT_CC
'Set who sent the e-mail.
email.Sender.Name = "Our name"
email.Sender.Address = "Our queue label"
'Set the subject of the e-mail.
email.Subject = "Test mail."
'Set the Body of the e-mail.
email.TextMessageData.Text = "This is the Body of the message."
'**********************
'* Compose message Body
'**********************
msg.Body = email.ComposeBody
'******************
'* Display subject.
'******************
MsgBox "The text of the message is:" + email.TextMessageData.Text
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, MSMQMailEMail, MSMQMessage, Name, Recipients, Sender, Subject, Text