Internet Messaging Functions (IMAP) > Alphabetical List of Functions > imap_logon

imap_logon

Example: imap_logon Internet Messaging Functions (IMAP)

Logs on to an IMAP server.

int imap_logon( char *transaction, char *url, [char *certificate, char *key, char *password, char* LocalAddr, char* STARTTLS,] LAST );
transaction A transaction name for this step in quotes. To avoid creating a transaction for this step, use a null string, "".
url The URL of the IMAP server in the following format:"URL=imap://johnd:letmein@exchange.mycompany.com:8123"
certificate The SSL certificate file of the IMAP server: "SSLCertificate=certfile.pem"
key The SSL private key of the IMAP server: "SSLCertificate=keyfile.pem"
password An SSL password required for the IMAP server: "SSLPassword=password",
LocalAddr Optional: Sets the preferred IP address of the client <ip_addr>[:<port>]. This option is useful for IP spoofing. Use the following format:
"LocalAddr=199.123.123.123"
STARTTLS Optional: Indicates that SMTP's StartTLS (Start Transport Layer Security) extension must be activated on the session. If the parameter is set, then SMTP protocol's 'STARTTLS' command will be issued on the session during logon and connection will be switched to TLS mode. Use the following format :
"STARTTLS"
LAST A marker indicating the end of the argument list.

The imap_logon function logs in to the IMAP server with authentication information, using a plaintext username and password.

Note that the IMAP handle must be either initialized to zero (0), or point to another valid IMAP handle. If you point to an existing IMAP handle whose session is open, imap_logon automatically logs out the user associated with the handle and connects the new user.

This function is for use with global sessions. For multiple sessions, use the imap_logon_ex function, which allows you to specify a session identifier.

Return Values

If this function succeeds, it returns LR_PASS. Otherwise, it returns LR_FAIL.

Parameterization

All arguments of this function of the type char, can be parameterized with standard parameterization.