Send
Send the email message after the header content and optional attachments or inline objects have been defined.
Send(
OptionList)
Parameters
Parameter | Type | Direction | Description |
---|---|---|---|
OptionList | string | In | Associative list of key-value pairs, to a
maximum of 10240 bytes. Valid options are:
|
Return Values
Value | Description |
---|---|
>0 | Mail successfully sent. Number of recipient addresses not accepted. |
0 | Success |
-2 | Invalid email address or Authentication error for all recipients. |
-6 | Size of message exceeds MaxSize option |
-8 | Not logged on |
-9 | Socket error |
-12 | Missing mandatory elements. Mandatory elements are FROM and one of the recipient fields: TO, CC, or BCC. |
-15 | Quota on server exceeded |
-18 | Memory allocation error |
< 0 | Failure |
Description
Use the Send operation to send the email message after the header content and optional attachments or inline objects have been defined.
When sending a message, the header must specify the sender and at least one recipient, so prior to using the Send operation you must call the following operations:
- LogonSMTP to connect with the SMTP server
- SetFrom to specify the Sender
- SetToList, SetCCList, or SetBCCList to specify a recipient
Recipient addresses that are invalid or not accepted are not included in the header's To: or CC: fields.
;ProcScript module such as operation, entry, or Detail trigger variables handle mailApiHandle endvariables ; Create an instance handle of the UPOPMAIL API component newinstance "UPOPMAIL", mailApiHandle ; Logon to the SMTP server mailApiHandle->LogonSMTP("mailhost.mygreatcorp.net", "", "") ; Specify the mail header information mailApiHandle->SetFrom(FROM.MESSAGE.DUMMY) mailApiHandle->SetToList(TO.MESSAGE.DUMMY) mailApiHandle->SetSubject(SUBJECT.MESSAGE.DUMMY) ; Specify the message body mailApiHandle->SetMessage(TEXT, "") ; plain text body mailApiHandle->SetMessage(HTML, "MIMEType=text/html") ; HTML body ; Add an attachment mailApiHandle->AddAttachmentFromFile(ATTACHMENT.MESSAGE.DUMMY, "") ; Send the mail mailApiHandle->Send("IgnoreRcptError=True") ; Handle the result vToErr = "" vCcErr = "" vBccErr = "" if (vResult>0) mailApiHandle->GetRecipientDetails(vToErr,vCcErr,vBccErr) else if (vResult<0) ... endif ; Clear the mail message structure from memory mailApiHandle->ClearMail() ; Log off the SMTP server mailApiHandle->LogoffSMTP()