The RecipientType property specifies how the e-mail is sent (MSMQMailRecipient) to the recipient.
Type: | Long |
Run time: | Read-write |
object.RecipientType
Syntax Element | Description |
---|---|
object | A recipient (MSMQMailRecipient) object that defines an e-mail recipient. |
RecipientType can have any one of the following values:
This property is automatically set whenever a recipient is added to the recipient list of an e-mail object (see the Type parameter of Add). Consequently, explicitly setting this property is seldom required.
Type is ignored if the recipient (MSMQMailRecipient) object represents the sender of an e-mail.
This example composes a message body from an e-mail object with three recipients, and parses the message body, and displays all the recipients who received a copy of the message.
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 emailReceived As New MSMQMailEMail
Dim recipient As MSMQMailRecipient
Dim msg As New MSMQMessage
Private Sub Form_Click()
'*********************
'* Define e-mail
'*********************
'Set e-mail type to form message.
email.ContentType = MSMQMAIL_EMAIL_FORM
'Add primary recipient.
email.Recipients.Add "Exchange_User1", "ExchangeUser@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_TO
email.Recipients.Add "Exchange_User2", "ExchangeUser@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_CC
email.Recipients.Add "Exchange_User3", "ExchangeUser@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_CC
'Set who sent the e-mail.
email.Sender.Name = "Our name"
email.Sender.Address = "Our queue label"
'Set subject of mail.
email.Subject = "Test form."
'Set form name.
email.FormData.Name = "Test form."
'Set form field list.
email.FormData.FormFields.Add "StringField", "Test Field"
'***************************
'* Compose and Parse message
'***************************
msg.Body = email.ComposeBody
emailReceived.ParseBody (msg.Body)
For Each recipient In email.Recipients
If recipient.RecipientType = MSMQMAIL_RECIPIENT_CC Then
MsgBox "Mail was copied to: " + recipient.Name
End If
Next recipient
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, Body, ComposeBody, ContentType, FormData, FormFields, MSMQMailEMail, MSMQMAILFormField, Name, ParseBody, Recipients, Subject, Text, TextMessageData, Value