OnSendFinished

Description

Occurs when an email is sent by SendAsync. If there is an error from SendAsync, this event gets the error number and error text.

Syntax

OnSendFinished(long handle, integer errornumber, string errortext) 

Event ID

Event ID

Objects

None

SMTPClient object


Arguments

Argument

Description

handle

The return handle of the SendAsync function.

errornumber

The return error number. Returns 1 if sending email succeeds and one of these negative numbers if it fails.

  • 1 -- Success.

  • -1 -- A general error occurred.

  • -2 -- Unable to connect to service through proxy.

  • -3 -- Couldn’t resolve proxy. The given proxy host could not be resolved.

  • -4 -- Couldn’t resolve host. The given remote host could not be resolved.

  • -5 -- Failed to connect to host.

  • -6 -- Host using bad/illegal format or missing host.

  • -7 -- Protocol is not supported.

  • -8 -- Error occurred when connecting with SSL.

  • -9 -- Server certificate is revoked.

  • -10 -- Service certificate authentication failed.

  • -11 -- Operation timeout.

  • -12 -- The remote server denied the Curl login.

  • -13 -- Failed to send the network data.

  • -14 – Failure in receiving network data.

  • -15 -- Incorrect username or password.

  • -16 -- Error reading local file.

  • -17 -- No sender has been specified.

  • -18 -- No recipients have been specified.

  • -19 -- Failed to convert the parameter with its current encoding. The parameter is invalid.

  • -20 -- Failed to convert the email with its current encoding due to insufficient memory.

  • -21 -- Failed to send the email because its encoding is unsupported.

  • -22 -- Failed to convert the email with its current encoding. A general error occurred.

errortext

The return error text. Returns null if sending email succeeds and one of the error texts if it fails.


Examples

The following example outputs the error message when failed to send the email asynchronously.

IF ErrorNumber <> 1 THEN
 wf_log( 'Failed to send the E-Mail. Handle = ' + String(Handle) + ', ErrorNumber = ' + String(ErrorNumber) + ", ErrorText = " + ErrorText + ".") )
END IF

Return Values

None.