Sender
MSMQMailEMail

The Sender property specifies who is sending the e-mail message. It includes the sender's name and address.

Type: MSMQMailRecipient
Run time: Read-write

Syntax

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

Settings

MSMQMailRecipient object.

Remarks

When setting the Sender property, the RecipientType property of the MSMQMailRecipient object can be ignored. The RecipientType property has no meaning when specifying who sent the message.

Sender can be used to create a Reply or Reply-All e-mail. To do this, add the Sender to the recipient list of the Reply e-mail.

Example

This example defines an e-mail form, specifying who sent the message. The e-mail object is composed into a mail message, and the sender 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
   
   'Set who sent the e-mail.
   email.Sender.Name = "Sender"
   email.Sender.Address = "Sender Application Input Queue"

   '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 recipient Sender.
   '***************************

   MsgBox "Recipient sender: " + email.Sender.Name + " at " + email.Sender.Address
   
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