RecipientType
MSMQMailRecipient

The RecipientType property specifies how the e-mail is sent (MSMQMailRecipient) to the recipient.

Quick Info

Type: Long
Run time: Read-write

Syntax

object.RecipientType
 
Syntax Element Description
object A recipient (MSMQMailRecipient) object that defines an e-mail recipient.

Settings

RecipientType can have any one of the following values:

MSMQMailRecipient_TO
Default. The recipient is the primary recipient of the e-mail.
MSMQMailRecipient_CC
The e-mail is copied to the recipient.
MSMQMailRecipient_BCC
The e-mail is blind copied to the recipient.

Remarks

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.

Example

This example composes a message body from an e-mail object with three recipients, then 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, and then 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
 

See Also

Add, Body, ComposeBody, ContentType, FormData, FormFields, MSMQMailEMail, MSMQMAILFormField, Name, ParseBody, Recipients, Subject, Text, TextMessageData, Value


© 1997 by Microsoft Corporation. All rights reserved.