CSmtpClient::GetLastError Method  
 
DWORD GetLastError();
DWORD GetLastError(
  CString& strDescription  
);

Parameters

strDescription
A string which will contain a description of the last error code value when the method returns. If no error has been set, or the last error code has been cleared, this string will be empty.

Return Value

The return value is the last error code value for the current thread. Functions set this value by calling the SetLastError method. The Return Value section of each reference page notes the conditions under which the method sets the last error code.

Remarks

Error codes are unsigned 32-bit values which are private to each calling thread. You should call the GetLastError method immediately when a method's return value indicates that an error has occurred. That is because some methods call SetLastError(0) when they succeed, clearing the error code set by the most recently failed method.

Most methods will set the last error code value when they fail; a few methods set it when they succeed. Function failure is typically indicated by a return value such as FALSE, NULL, INVALID_CLIENT or SMTP_ERROR. Those methods which call SetLastError when they succeed are noted on the method reference page.

The description of the error code is the same string that is returned by the GetErrorString method.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: csmtpv11.lib

See Also

GetErrorString, SetLastError, ShowError