MAPISetRecipient

Syntax

MAPISetRecipient(RecipClass, RecipName$, Address$)

Remarks

Adds one recipient to the current outbound message. Use MAPISetRecipientList to add a recipient list with one or more recipients to the current outbound message.

Either RecipName or Address can be an empty string (""). If Address is an empty string (""), the recipient is treated as unresolved, and MAPISendMail automatically attempts resolution when the message is sent. If RecipName cannot be resolved unambiguously, MAPISendMail returns an error.

Argument

Explanation

RecipClass

Classifies the recipient of the message.

The following RecipClass values are defined:

MAPI_ORIG = 0
MAPI_TO = 1
MAPI_CC = 2
MAPI_BCC = 3

Set MAPI_TO to specify a To recipient.

Set MAPI_CC to specify a carbon-copy (CC) recipient.

Set MAPI_BCC to specify a blind carbon-copy (BCC) recipient.

Do not set MAPI_ORIG. The messaging system automatically establishes the originator.

RecipName$

The friendly name of the recipient as displayed by the messaging system.

Address$

Provider-specific message delivery data. This field can be used by the message system to identify recipients who are not in an address list (custom recipients).


Example

The following example adds two recipients to the current outbound message,
then sends the message. The To recipient is resolved, and the CC recipient is unresolved. If the unresolved recipient cannot be resolved unambiguously, MAPISendMail returns an error.


Sub MAIN
MAPI_LOGON_UI = 1
Session = MAPILogon(0, "", "", MAPI_LOGON_UI, 0)
MAPI_TO = 1
MAPI_CC = 2
result = MAPISetRecipient(MAPI_TO, "Phillipe Tran", \
    "AF:TBU/WGAM/PHILT")
result = MAPISetRecipient(MAPI_CC, "Patricia Loren", "")
result = MAPISendMail(Session, 0, "Monthly Summary",\
    "We will quickly satisfy all orders for clamps.", 0, 0)
result = MAPILogoff(Session, 0, 0, 0)
End Sub