To Property (MailEnvelope Object)

Microsoft Office InfoPath

Sets or retrieves a string containing the send-to value used in the MailEnvelope object that is associated with a Window object.

expression.To

expression    Required. An expression that returns a reference to the MailEnvelope object.

Security Level

2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Remarks

The values set for the To property should be a string of valid e-mail addresses. You can specify multiple e-mail addresses by using ";" between each of them, as shown in the following example:

objEmail.To = "[email protected];[email protected]"

Example

In the following example, the To property of the MailEnvelope object is used to set the send-to value of a custom e-mail message:

function CreateMailEnvelope::OnClick(eventObj)
{
   var objEmail;

   objEmail = Application.ActiveWindow.MailEnvelope;
   objEmail.To = "[email protected]";
   objEmail.CC = "[email protected]";
   objEmail.BCC = "[email protected]";
   objEmail.Subject = "Test e-mail message";
   objEmail.Visible = true;
   objEmail = null;
}