GetLastErrorCode Method
Previous  Top  Next


GetLastErrorCode
method returns error code of the last synchronous send operation.

Syntax

[Visual Basic]


Function
 GetLastErrorCode() As Long

Example:

numErrorCode = objSmtpMail.GetLastErrorCode

[VBScript]


Function
 GetLastErrorCode()

Example:

numErrorCode = objSmtpMail.GetLastErrorCode

[C#]


int
 GetLastErrorCode();

Example:

int
 numErrorCode = objSmtpMail.GetLastErrorCode();

[C++]


HRESULT GetLastErrorCode(LONG* pnumErrorCode);

Example:

int
 numErrorCode = spSmtpMail->GetLastErrorCode();


Parameters

None.

Return value

Returns numeric error code:
0 if the last 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

GetLastErrorCode can be used to obtain error code of the last synchronous send operation, i.e. the error code from the last call of Send, SimpleSend, SimpleSendAttachment, SimpleSendScriptable or SimpleSendAttachmentScriptable.