| |
| INT WINAPI ImapLogin(
|
| |
HCLIENT hClient, |
|
| |
UINT nAuthType, |
|
| |
LPCTSTR lpszUserName, |
|
| |
LPCTSTR lpszPassword |
|
| );
|
The ImapLogin function authenticates the specified user
in on the server. This function must be called after the connection
has been established, and before attempting to retrieve messages or
perform any other function on the server.
Parameters
- hClient
- Handle to the client session.
- nAuthType
- Identifies the type of authentication that should be used when
the client logs in to the mail server. The following authentication
methods are supported:
| Constant |
Description |
| IMAP_AUTH_LOGIN |
Standard cleartext username and password is sent to the server.
This authentication method is supported by all servers. Note that
some servers may only support LOGIN authentication if a secure
connection has been established. |
| IMAP_AUTH_PLAIN |
Login using the PLAIN authentication mechanism as defined in
RFC 4959. This authentication method is supported by most servers,
although some may require that client establish a secure
connection. |
| IMAP_AUTH_ANONYMOUS |
Login using the anonymous Simple Authentication and Security
Layer (SASL) mechanism as defined in RFC 4505. If this
authentication method is specified, the lpszUserName
parameter should specify a name or e-mail address acceptable to the
mail server. The lpszPassword parameter is ignored and may
be NULL. |
- lpszUserName
- Points to a null-terminated string that specifies the user name
to be used to authenticate the current client session.
- lpszPassword
- Points to a null-terminated string that specifies the password
to be used to authenticate the current client session.
Return Value
If the function succeeds, the return value is zero. If the
function fails, the return value is IMAP_ERROR. To get extended
error information, call ImapGetLastError.
Remarks
In some cases, the user may be pre-authenticated by the server.
In this case, the function will fail with the last error set to
ST_ERROR_ALREADY_AUTHENTICATED. If a particular authentication
method is not supported by the server, the last error will be set
to ST_ERROR_INVALID_AUTHENTICATION_TYPE. For compatibility with the
greatest number of servers, it is recommended that you use
IMAP_AUTH_LOGIN as the authentication method.
Requirements
Client: Requires Windows 7, Windows Vista or Windows
XP.
Server: Requires Windows Server 2008 or Windows Server
2003.
Header: Include cstools7.h.
Library: Use csmapav7.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
ImapAsyncConnect, ImapConnect, ImapDisconnect, ImapInitialize, ImapUninitialize
|
|