GetErrorCode Method
Previous  Top  Next


GetErrorCode
method obtains error code for a message that was queued for sending using SendAsync method and failed to be sent.

Syntax

[Visual Basic]


Function
 GetErrorCode(numMessageNumber As LongAs Long

Example:

numErrorCode = objSmtpMail.GetErrorCode(numMessageNumber)

[VBScript]


Function
 GetErrorCode(numMessageNumber)

Example:

numErrorCode = objSmtpMail.GetErrorCode(numMessageNumber)

[C#]


int
 GetErrorCode(int numMessageNumber);

Example:

int
 numErrorCode = objSmtpMail.GetErrorCode(numMessageNumber);

[C++]


HRESULT GetErrorCode(LONG numMessageNumber, LONG* pnumErrorCode);

Example:

int
 numErrorCode = spSmtpMail->GetErrorCode(numMessageNumber);


Parameters

numMessageNumber [in]
Message number returned from the SendAsync method.

Return value

Returns numeric error code:
0 if message was sent successfully;
-1 if connection to the server failed or in case of other Winsock errors;
>0 SMTP error code as defined in RFC 821
page 34-35.

Remarks

SendAsync method places a message into a message queue and returns message number which identifies the message. If the message failed to be sent status of the message becomes MailStatusFailed and GetErrorCode method can be used to obtain error code.