Description
Adds an email address and display name to the "To" field of the email.
Applies to
Syntax
mimemessage.AddRecipient(string recipient{, string displayname})
Argument |
Description |
---|---|
mimemessage |
A MimeMessage object identifying the email message in which you want to add the recipient's email address and display name. |
recipient |
A string that contains the recipient's email address. |
displayname (optional) |
A string that contains the recipient's email display name. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, the method returns null.
Examples
The following example adds two recipients' email addresses, one of which has the email display name.
lnv_SmtpClient.Message.AddRecipient("Tester1@gmail.com") lnv_SmtpClient.Message.AddRecipient("Tester2@gmail.com", "Tester2Name")
The following example adds three recipients' email addresses.
Integer i String strRecive[3]={"Recv1@gmail.com","Recv2@gmail.com","Recv3@gmail.com"} FOR i = 1 To UpperBound(strRecive) li_rc = lnv_SmtpClient.Message.AddRecipient(strRecive[i]) IF li_rc = -1 THEN messagebox("Error","Failed to add recipient.") END IF NEXT
See also