9.135 MAIL_ADD_RECIPIENT
This Email handling Built-In Function is used to add the name of a recipient for the current email.
Successive calls enable an internal list of recipients to be built up. As a minimum you would normally define at least one recipient of class "TO".
Arguments
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | A | Req | Recipient Class. Values: TO - To | 2 | 3 | ||
2 | A | Req | Display name of the message recipient. | 1 | 255 | ||
3 | A | Opt | Recipient's address. This address is provider-specific message delivery data. | 1 | 255 |
Return Values
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | A | Opt | Return Code OK - Action completed ER - Error occurred | 2 | 2 |
Technical Notes
No recipients are defined immediately following a MAIL_START call.
The optional Recipient's address may be an address entered by the user for a recipient not in an address book (that is, a custom recipient). Default behavior is mail system specific. MAPI will typically require that you provide this address in the form:
<address type>:<full address>
For example:
Microsoft PC Mail: | MS:network/postoffice/mailbox |
Internet: | SMTP:mailbox@companyname.com |
Under IBM i, enter the full email address (the address type prefix SMTP: is optional) in the display name argument or the sender's address argument if a display name is specified. A mail message requires a minimum of one recipient.
Details of the email definition will be lost unless the MAIL_SEND Built-In Function is used to send the message.
If any error occurs, all details of the email definition will be destroyed. To restart processing, a new call to MAIL_START is required.
Example
This example shows only this function. Refer to the 9.140 MAIL_START example, which defines all details of an Email message.
Note: If you wish to use this example for testing you should insert a valid display name as the second argument and insert a valid recipient's address as the third argument.
********** COMMENT(Set Recipient using TO argument)
********** COMMENT(may also set others for TO CC BCC)
lansaELSE
USE BUILTIN(MAIL_ADD_RECIPIENT) WITH_ARGS(TO '<-- name -->' 'SMTP:<-- recipient@address -->')
TO_GET(#LEM_RETC)