[Email_Status] returns the status of an email message that was sent using [Email_Send] or [Email_Queue]. The method requires the unique ID of the email message which is returned using [Email_Result].
The method will return a value of "queued", "error", or "sent". Lasso attempts to send messages multiple times if minor errors are encountered. A valid message will have a status of "queued" until the maximum number of retries is reached. Messages which are invalid or have reached their retry limit will have a status of "error". Messages which have been sent (or are not found in the queue) will have a status of "sent".
Note that [Email_Status] called immediately after queueing a message will almost always return "queued" since Lasso has not yet had a chance to send the message. It can take a few seconds on an idle server to send a message or longer on a busy server. This method would typically be used by storing the unique ID returned by [Email_Result] in a database and then checking on the status of the message after a suitable delay.
email_send(...)
var(id) = email_result
email_status($id)
The code below will queue up an email message using [email_send], wait for a minute, and then display its status. Email status should be one of 'queued', 'sent', or 'error'.
Code
email_send(-host='mail.example.com',
-to='administrator@example.com',
-from='administrator@example.com',
-subject='For Your Eyes Only!',
-body='Top Secret Company Information.'
)
var(msg_id) = email_result
sleep(60000)
email_status($msg_id)
Result
sent
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments