Recipients
MSMQMailEMail

The Recipients property specifies the intended list of recipients for the e-mail message.

Type: MSMQMailRecipientList
Run time: Read-write

Syntax

object.Recipients
 
Syntax Element Description
object An e-mail (MSMQMailEMail) object that defines an e-mail message.

Settings

MSMQMailRecipientList object.

Remarks

Each recipient in the e-mail's recipient list is represented by an MSMQMailRecipient object. Each recipient object includes a name and address for the recipient, an input queue of the recipient, and how the message is sent to the recipient.

Example

This example defines an e-mail form, adding three recipients to the e-mail's recipient list. The e-mail object is composed into a mail message, and each recipient is displayed.

To try this example using Microsoft® Visual Basic® (version 5.0), paste the code into the Code window of a form, enter a valid user address for each recipient, run the example, and click the form.

Dim email As New MSMQMailEMail
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 Recipients.
   email.Recipients.Add "Exchange_User", "UserAlias@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_TO
   email.Recipients.Add "MAPI_User", "MAPIUserInputQueueLabel", MSMQMAIL_RECIPIENT_CC
   email.Recipients.Add "MSMQApplication", "ApplicationInputQueueLabel", MSMQMAIL_RECIPIENT_BCC
   
   'Set who sent the e-mail.
   email.Sender.Name = "Our name"
   email.Sender.Address = "Our queue label"

   'Set subject of mail.
   email.Subject = "Test mail"
   
   'Set name of form
   email.FormData.Name = "Test form"
   
   'Set form field list.
   email.FormData.FormFields.Add "StringField", "Test Field"
   
   'Compose message Body
   msg.Body = email.ComposeBody


   '*********************
   '* Display Recipients.
   '*********************

   Dim recipient As MSMQMailRecipient

   For Each recipient In email.Recipients
       MsgBox "Recipient: " + recipient.Name + " at " + recipient.Address
   Next recipient

End Sub
 

QuickInfo

  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.

See Also

Add, Address, ComposeBody, ContentType, FormData, FormFields, MSMQMailEMail, Name, Sender, Subject