The IMAP4 client commands are described in the IMAP4rev1 specification, RFC 3501. All commands have straightforward translations into member functions in the Imap4Client class. RFC 3501 also describes the possible server responses. All server responses have straightforward translations into subclasses of Response. Brief descriptions of some of the client commands are included in this documentation. However, RFC 3501 is authoritative on the IMAP4rev1 protocol, so it's a good idea to refer to it frequently.
To use the Imap4Client class, first create an instance of the class. Then call the Connect() member function to connect to the IMAP4 server. After you have connected, you may invoke member functions of Imap4Client to send client commands to the IMAP4 server. After each command, you must process the responses received from the IMAP4 server. When you are finished invoking commands, call Logout() to log out from the session, followed by Disconnect() to close the connection to the server.
After invoking a client command, you must process the server's responses, which are collected by the Imap4Client object. The client command member functions are synchronous, which means that when you call one of the functions, it does not return until it has received a success or failure response from the IMAP4 server. An IMAP4 server can send any number of responses following a client command. To see how many responses were received, call the NumResponses() member function. Once you know how many responses there are, you may call ResponseAt() to iterate through them or to access them randomly. The collection of responses is cleared at the beginning of each client command, so pointers to any Response objects become invalid when you invoke a function that sends a client command.
When you invoke an IMAP4 client command, you must be prepared to handle errors. If a network error occurs, the member function returns -1. Your program should always check the return value. To get more specific information about a network error, you may call the member functions ErrorCode() and ErrorMessage(). In addition to network errors, your code should be prepared to handle IMAP4 server errors. After you invoke a client command, you should check the responses from the server. A tagged OK response from the server indicates no error. A tagged NO or BAD response indicates an error. You may get more information about the error from the response code or response text. (See NoResponse and BadResponse.) You may call the convenience member function CommandStatus() to get the OK, NO, or BAD status result of the last command.
As with any network protocol, it is possible for a connection to stop responding. This could happen, for example, if a network element were to stop functioning or if the server stopped responding. To recover from this situation, the Imap4Client class provides a Cancel() member function. You can call Cancel() safely from another thread to terminate the network connection and unblock the thread that is blocked on a client command execution. After you call Cancel(), all client command functions return an error, which is the normal behavior when there is no connection to an IMAP4 server. To continue with the recovery, you must call Connect() again to re-establish the connection to the server.
Public Member Functions | |
| Imap4Client () | |
| Default constructor. | |
| virtual | ~Imap4Client () |
| Destructor. | |
| void | SetTraceOutput (TraceOutput *out, bool takeOwnership) |
| Sets a Trace Output instance. | |
| void | SetTimeout (int secs) |
| Sets the timeout value for network send and receive operations. | |
| void | SetReceiveTimeout (int secs) |
| Sets the timeout value for network receive operations. | |
| void | SetSendTimeout (int secs) |
| Sets the timeout value for network send operations. | |
| void | Cancel () |
| Cancels a currently executing command. | |
| int | Connect (const char *address, int port=143, bool wait=true) |
| Opens a connection to an IMAP4 server. | |
| int | ConnectTls (const char *serverHostName, bool wait=false) |
| Establishes a TLS connection over an existing TCP connection. | |
| int | ConnectTlsOpenSSL (const char *serverHostName, void *ssl, bool wait=false) |
| Establishes a TLS connection over an existing TCP connection. | |
| void | Disconnect () |
| Closes the connection to the IMAP4 server. | |
| CommandStatusCode | CommandStatus () const |
| Indicates if the last command succeeded. | |
| int | Capability () |
| Sends the CAPABILITY command. | |
| int | Noop () |
| Sends the NOOP command. | |
| int | Logout () |
| Sends the LOGOUT command. | |
| int | Starttls () |
| Sends the STARTTLS command. | |
| int | AuthenticatePlain (const char *user, const char *password, const char *authorizeUser=0) |
| Sends the AUTHENTICATE PLAIN command. | |
| int | AuthenticateCramMd5 (const char *user, const char *password) |
| Sends the AUTHENTICATE CRAM-MD5 command. | |
| int | AuthenticateNtlm (const char *user, const char *password) |
| Sends the AUTHENTICATE NTLM command. | |
| int | Login (const char *name, const char *password) |
| Sends the LOGIN command. | |
| int | Select (const char *mailboxName) |
| Sends the SELECT command. | |
| int | Examine (const char *mailboxName) |
| Sends the EXAMINE command. | |
| int | Create (const char *mailboxName) |
| Sends the CREATE command. | |
| int | Delete (const char *mailboxName) |
| Sends the DELETE command. | |
| int | Rename (const char *oldName, const char *newName) |
| Sends the RENAME command. | |
| int | Subscribe (const char *mailboxName) |
| Sends the SUBSCRIBE command. | |
| int | Unsubscribe (const char *mailboxName) |
| Sends the UNSUBSCRIBE command. | |
| int | List (const char *reference, const char *mailboxName) |
| Sends the LIST command. | |
| int | Lsub (const char *reference, const char *mailboxName) |
| Sends the LSUB command. | |
| int | Status (const char *mailboxName, const char *items) |
| Sends the STATUS command. | |
| int | Append (const char *mailboxName, const char *flags, const char *date, const char *message) |
| Sends the APPEND command. | |
| int | Append (const char *mailboxName, const char *flags, const char *date, StreamBuffer &sbuf) |
| Sends the APPEND command. | |
| int | Check () |
| Sends the CHECK command. | |
| int | Close () |
| Sends the CLOSE command. | |
| int | Expunge () |
| Sends the EXPUNGE command. | |
| int | Search (const char *charset, const char *criteria) |
| Sends the SEARCH command. | |
| int | Fetch (int msgNum, const char *items) |
| Sends the FETCH command with a single message sequence number. | |
| int | Fetch (int firstMsgNum, int lastMsgNum, const char *items) |
| Sends the FETCH command with a range of message sequence numbers. | |
| int | Fetch (const char *set, const char *items) |
| Sends the FETCH command with a message sequence number set. | |
| int | Store (int msgNum, const char *item, const char *value) |
| Sends the STORE command with a single message sequence number. | |
| int | Store (int firstMsgNum, int lastMsgNum, const char *item, const char *value) |
| Sends the STORE command with a range of message sequence numbers. | |
| int | Store (const char *set, const char *item, const char *value) |
| Sends the STORE command with a message sequence number set. | |
| int | Copy (int msgNum, const char *mailboxName) |
| Sends the COPY command with a single message sequence number. | |
| int | Copy (int firstMsgNum, int lastMsgNum, const char *mailboxName) |
| Sends the COPY command with a range of message sequence numbers. | |
| int | Copy (const char *set, const char *mailboxName) |
| Sends the COPY command with a message sequence number set. | |
| int | UidFetch (int uid, const char *items) |
| Sends the UID FETCH command with a single message UID. | |
| int | UidFetch (int firstUid, int lastUid, const char *items) |
| Sends the UID FETCH command with a range of message UIDs. | |
| int | UidFetch (const char *set, const char *items) |
| Sends the UID FETCH command with a message UID set. | |
| int | UidStore (int uid, const char *item, const char *value) |
| Sends the UID STORE command with a single message UID. | |
| int | UidStore (int firstUid, int lastUid, const char *item, const char *value) |
| Sends the UID STORE command with a range of message UIDs. | |
| int | UidStore (const char *set, const char *item, const char *value) |
| Sends the UID STORE command with a message UID set. | |
| int | UidCopy (int uid, const char *mailboxName) |
| Sends the UID COPY command with a single message UID. | |
| int | UidCopy (int firstUid, int lastUid, const char *mailboxName) |
| Sends the UID COPY command with a range of message UIDs. | |
| int | UidCopy (const char *set, const char *mailboxName) |
| Sends the UID COPY command with a message UID set. | |
| int | UidSearch (const char *charset, const char *criteria) |
| Sends the UID SEARCH command. | |
| int | SetQuota (const char *quotaRoot, const char *resourceList) |
| Sends the SETQUOTA command. | |
| int | GetQuota (const char *quotaRoot) |
| Sends the GETQUOTA command. | |
| int | GetQuotaRoot (const char *mailboxName) |
| Sends the GETQUOTAROOT command. | |
| int | Namespace () |
| Sends the NAMESPACE command. | |
| int | ProxyAuth (const char *userName) |
| Sends the PROXYAUTH command. | |
| int | NumResponses () const |
| Gets the number of responses received from the server. | |
| const Response & | ResponseAt (int index) const |
| Gets the response at the specified position. | |
| Error | ErrorCode () const |
| Gets the platform-independent error code of last error. | |
| int | OsErrorCode () const |
| Gets the platform-specific error code of last error. | |
| const char * | ErrorMessage () const |
| Gets the error message associated with last error. | |
|
|
Default constructor. |
|
|
Destructor. The destructor performs all necessary clean-up. If the connection to the server is open, the destructor closes it. |
|
||||||||||||||||||||
|
Sends the APPEND command. The APPEND command requests the server to add a new message to a mail folder (called a "mailbox" in the IMAP4 specification). The APPEND command can optionally set flags for the message and the internal date of the message. The message must be in a format compatible with RFC 2822 or MIME -- that is, in the standard Internet email format. This version of the Append member function takes the message as a StreamBuffer. An alternative version, Append(const char*, const char*, const char*, const char*) takes the message as a NUL-terminated char array.
|
|
||||||||||||||||||||
|
Sends the APPEND command. The APPEND command requests the server to add a new message to a mail folder (called a "mailbox" in the IMAP4 specification). The APPEND command can optionally set flags for the message and the internal date of the message. The message must be in a format compatible with RFC 2822 or MIME -- that is, in the standard Internet email format. This version of the Append member function takes the message as a NUL-terminated char array. An alternative version, Append(const char*, const char*, const char*, StreamBuffer&) takes the message as a StreamBuffer.
|
|
||||||||||||
|
Sends the AUTHENTICATE CRAM-MD5 command. The AUTHENTICATE CRAM-MD5 command authenticates a user to the IMAP4 server. If the authentication succeeds, the server sends a tagged OK response. If the authentication fails, the server sends a tagged NO response. CRAM-MD5 is the name of a registered SASL authentication mechanism, which is supplied as a parameter to the generic AUTHENTICATE command. (SASL, described in RFC 2222, means "Simple Authentication and Security Layer".) The CRAM-MD5 authentication mechanism is described in RFC 2195. CRAM-MD5 is more secure than the PLAIN authentication mechanism because the password is not sent across the network.
|
|
||||||||||||
|
Sends the AUTHENTICATE NTLM command. The AUTHENTICATE NTLM command authenticates a user to the IMAP4 server. If the authentication succeeds, the server sends a tagged OK response. If the authentication fails, the server sends a tagged NO response. NTLM is the name of a registered SASL authentication mechanism, which is supplied as a parameter to the generic AUTHENTICATE command. (SASL, described in RFC 2222, means "Simple Authentication and Security Layer".) The NTLM authentication mechanism is used to authenticate users in a Microsoft Windows environment, and is a popular option for authentication with Microsoft Exchange Server. CRAM-MD5 is considered to be more secure than the NTLM authentication mechanism. You can use the AuthenticateCramMd5() member function to send the AUTHENTICATE CRAM-MD5 command.
|
|
||||||||||||||||
|
Sends the AUTHENTICATE PLAIN command. The AUTHENTICATE PLAIN command authenticates a user to the IMAP4 server. If the authentication succeeds, the server sends a tagged OK response. If the authentication fails, the server sends a tagged NO response. PLAIN is the name of a registered SASL authentication mechanism, which is supplied as a parameter to the generic AUTHENTICATE command. (SASL, described in RFC 2222, means "Simple Authentication and Security Layer".) The PLAIN authentication mechanism is described in RFC 2595. PLAIN is the least secure of all the SASL authentication mechanisms, since the password is sent unencrypted across the network. The CRAM-MD5 authentication mechanism is much more secure. You can use the AuthenticateCramMd5() member function to send the AUTHENTICATE CRAM-MD5 command. The AuthenticatePlain() member function takes a user name and password as required parameters, and an authorization ID as an optional parameter. The function sends the user name and password to the server for authentication, that is, for login. If you provide an authorization ID, the function sends it to the server for authorization, which allows the authenticated user to act on another user's account. (Normally, this kind of authorization requires special privileges for the authenticated user.)
|
|
|
Cancels the currently executing command. Since it is possible for a network connection to stop responding, an interactive application must be able to cancel a command that is waiting on a network operation (connect, send, or receive). For this reason, the Imap4Client class provides a Cancel() member function, which promptly terminates any currently executing client command. Cancel() is the only member function that is safe to call from another thread. In a typical situation, you have one thread that executes IMAP4 commands, and another thread that serves the user interface. A user action to cancel is serviced by the user interface thread, which calls Cancel() on the Imap4Client object to cancel a command. The command function that the IMAP4 client thread was executing at the time may return an error. (It will return an error if the cancel operation occurred before the command was completed.) Because it is difficult to recover the client/server state after a cancel operation, the library closes the connection whenever you call the Cancel() member function. You must call Connect() again to reconnect to the IMAP4 server. Note: You should not call the Connect() function from the same thread thread that called Cancel().
|
|
|
Sends the CAPABILITY command. The CAPABILITY command requests the server to send a list of features (that is, capabilities) that it supports. In response to the CAPABILITY command, the IMAP4 server sends a CAPABILITY response.
|
|
|
Sends the CHECK command. The CHECK command requests the server to establish a checkpoint for the currently selected mailbox. The actions that occur to establish a checkpoint are server-dependent. If any failures occur after a checkpoint, it should be possible for the server to reliably return to the state at the time of the checkpoint.
|
|
|
Sends the CLOSE command. The CLOSE command requests the server to close the currently selected mailbox. When the server closes a mailbox, it permanently deletes (expunges) all messages in the mailbox that are marked with the \Deleted flag. After a CLOSE command, the server is no longer in the SELECTED state (that is, no mailbox is selected).
|
|
|
Indicates if the last command succeeded. This convenience function examines the responses from the server and indicates if the last command succeeded. Normally, you call this function after every command to learn if the command succeeded or failed at the server. Failures can happen at different layers and for different reasons. At the network layer, communication with the server can fail. At the application layer, command execution at the server can fail. If the command succeeds, the server returns a tagged OK response. If the command fails, the server returns either a tagged NO response or a tagged BAD response. If communication with the server fails, the client receives no response from the server. You may call this function to learn the status of the most recent command. If the command succeeded at the server and the server sent a tagged OK response, the function returns Imap4Client::OK. If the command failed and the server sent a tagged NO response or a tagged BAD response, the function returns Imap4Client::NO or Imap4Client::BAD, respectively. If the client did not receive a tagged OK, NO, or BAD response from the server, the function returns Imap4Client::ERR.
|
|
||||||||||||||||
|
Opens a connection to an IMAP4 server. This member function opens a connection to the host at network address address and TCP port port. The address parameter may be a hostname ("imap4.example.com"), an IP address in dotted decimal form ("192.168.2.25"), or an IPv6 address in hexadecimal form ("2002:458c:68f7:0:203:baff:fe0b:74ba"). The default value for port is 143, the well-known TCP port number for IMAP4. If the client connects to the server successfully, then Connect() returns 0. If the client fails to connect to the server -- for example, if the host is not found or some other network error occurs -- then Connect() returns -1. If Connect() returns 0, then you should also check the responses from the server. The server sends an untagged OK response if it is ready to process commands. You can check the server's responses by calling the NumResponses() and ResponseAt() member functions. You may call the Cancel() member function from another thread to cancel this operation. If the optional parameter wait is true, it causes the client to wait for the server's greeting. In the IMAP4 protocol, the server always begins the dialog with its initial greeting. However, if you need to establish a TLS connection to the server, you may set wait to false. Then, the function returns immediately after the TCP connection is established without waiting for the server's initial greeting.
|
|
||||||||||||
|
Opens a TLS connection over an existing TCP connection. Transport Layer Security (TLS) provides server authentication and private communication over a TCP connection. TLS is the successor to Secure Sockets Layer (SSL), and individuals often use the term SSL even if the actual protocol is TLS. TLS is a standards track protocol developed by the IETF and described in RFC 2246. Before you call ConnectTls(), you must have established a TCP connection to the server. You must also have configured the TlsConfig object. Normally, you configure the TlsConfig object when you initialize your application. ConnectTls() starts a dialog between client and server, called a TLS handshake, to negotiate security parameters for the secure connection and to authenticate the server. If the handshake succeeds, a secure TLS connection is established between client and server. During the TLS handshake, the server sends a certificate to the client, and the client examines the certificate to verify the identity of the server. The certificate must be valid, and it must contain the host name of the server. When you call ConnectTls(), you provide the server's host name in the serverHostName parameter. The library tries to match serverHostName with the host name in the certificate. If the match fails, but the handshake otherwise succeeds, then the function returns -1, and the error code is BAD_CERTIFICATE_NAME_ERROR. In many applications, a BAD_CERTIFICATE_NAME_ERROR is not automatically treated as a fatal error; rather, the application presents an alert to the user and allows the user the choice to abort the connection or to continue and ignore the failure. Therefore, BAD_CERTIFICATE_NAME_ERROR should be treated as a severe warning: the server authentication failed but the secure connection succeeded. You should treat any other error that occurs during the handshake as a fatal error and close the TCP connection. If the optional parameter wait is true, it causes the client to wait for the server's greeting. It is important to set the correct value for this parameter. There are two cases: In the first case, you call Connect() to connect to a special secure IMAP4 port (TCP port 993) and then immediately call ConnectTls() to create a TLS connection. In this case, you call Connect() with wait false and you call ConnectTls() with wait true. In the second case, you call Connect() to connect to the standard IMAP4 port (TCP port 143). Then you call Starttls() to indicate to the server that you want to begin a TLS handshake. Then you call ConnectTls() create a TLS connection. In this case, you call Connect() with wait true (the default), and you call ConnectTls() with wait false (also the default). The function returns 0 on success and -1 on failure. To check the error code after a failure, call ErrorCode().
|
|
||||||||||||||||
|
Opens a TLS connection over an existing TCP connection, using a specified SSL struct. For simple use of TLS, you may use the ConnectTls() member function. For advanced use, you may use this member function, which allows you to create an SSL struct and pass it to the library to use. Examples of situations where you may choose to use the ConnectTlsOpenSSL() function include:
To use ConnectTlsOpenSSL(), you must call the OpenSSL function SSL_new(SSL_CTX*) to create an SSL struct. After you configure the SSL struct, you pass it as the ssl parameter to ConnectTlsOpenSSL(). The Imap4Client destructor calls SSL_free(SSL*) to free the SSL struct. However, OpenSSL uses a reference counting mechanism, and you may use that mechanism to prevent the Imap4Client destructor from freeing the SSL struct. To prevent the Imap4Client's destructor from freeing the SSL struct, increment the reference count before you pass the struct to the Imap4Client, like so:
CRYPTO_add(&ssl->references, 1, CRYPTO_LOCK_SSL);
|
|
||||||||||||
|
Sends the COPY command. The COPY command requests the server to copy one or more messages from the currently selected mailbox to a different mailbox. This version of the overloaded member function allows multiple messages to be copied, as specified by a set of message sequence numbers. The set parameter should specify a set of message sequence numbers in the syntax given in RFC 3501. In this syntax, individual sequence numbers or sequence number ranges are separated by commas, and ranges are indicated using a colon.
|
|
||||||||||||||||
|
Sends the COPY command. The COPY command requests the server to copy one or more messages from the currently selected mailbox to a different mailbox. This version of the overloaded member function allows multiple messages to be copied, as specified by a range of message sequence numbers. The parameter firstMsgNum should be the sequence number of the first message in the range, and lastMsgNum should be the sequence number of the last message in the range. The range in inclusive.
|
|
||||||||||||
|
Sends the COPY command. The COPY command requests the server to copy one or more messages from the currently selected mailbox to a different mailbox. This version of the overloaded member function allows one message to be copied. The parameter msgNum should be the sequence number of a single message to copy.
|
|
|
Sends the CREATE command. The CREATE command requests the server to create a new mailbox (sometimes called a mail folder). The mailboxName parameter should contain the name of the new mailbox.
|
|
|
Sends the DELETE command. The DELETE command requests the server to delete an existing mailbox. The mailboxName parameter should contain the name of the mailbox to be deleted.
|
|
|
Closes the connection to the IMAP4 server. The correct way to end an IMAP4 session is to send a LOGOUT command, which causes the server to perform any necessary closing operations and close the connection. Therefore you should almost always call Logout() just before you call Disconnect(). You may safely call this method even if the client is not connected.
|
|
|
Gets the platform-independent error code for the last error. The error codes are enumerated in the file mailpp/Error.h. Note that they are defined in the mailpp namespace. The ErrorMessage() member function returns a textual description of the platform-independent error. If the error code is SYSTEM_ERROR, you may call OsErrorCode() to get more detailed information about the error.
|
|
|
Gets the error message for the last error. This function returns a textual description of the platform-independent error code.
|
|
|
Sends the EXAMINE command. The EXAMINE command is similar to a SELECT command with one difference: EXAMINE selects the mailbox read-only.
|
|
|
Sends the EXPUNGE command. The EXPUNGE command causes the server to permanently delete the messages in the currently selected mailbox that have the \Deleted flag set. The server sends an EXPUNGE response for each message deleted.
|
|
||||||||||||
|
Sends the FETCH command. The FETCH command requests the server to return one or more messages, parts of messages, or message attributes. The server sends one or more FETCH responses that contain the requested information. This version of the overloaded member function allows information for multiple messages to be fetched, as specified by a set of message sequence numbers. The set parameter should specify a set of message sequence numbers in the syntax given in RFC 3501. In this syntax, individual sequence numbers or sequence number ranges are separated by commas, and ranges are indicated using a colon.
|
|
||||||||||||||||
|
Sends the FETCH command. The FETCH command requests the server to return one or more messages, parts of messages, or message attributes. The server sends one or more FETCH responses that contain the requested information. This version of the overloaded member function allows information for multiple messages to be fetched, as specified by a range of message sequence numbers. The parameter firstMsgNum should be the sequence number of the first message in the range, and lastMsgNum should be the sequence number of the last message in the range. The range in inclusive.
|
|
||||||||||||
|
Sends the FETCH command. The FETCH command requests the server to return one or more messages, parts of messages, or message attributes. The server sends one or more FETCH responses that contain the requested information. This version of the overloaded member function allows information for a single message to be fetched. The parameter msgNum should be the sequence number of the message.
|
|
|
Sends the GETQUOTA command. An IMAP4 client may send the GETQUOTA command to get information about resource usage and limits, such as the amount of storage used and the storage limit. The GETQUOTA command takes a quota root name as a parameter. (You may send the GETQUOTAROOT command to get a list of quota roots for a particular mailbox.) In response to the GETQUOTA command, the server sends a QUOTA response that reports resource usage and limits. The GETQUOTA command is an optional IMAP4 command. An IMAP4 server that supports the GETQUOTA command returns the QUOTA keyword in its CAPABILITY response.
|
|
|
Sends the GETQUOTAROOT command An IMAP4 client may send the GETQUOTAROOT command to get a list of quota roots that apply to a mailbox. A quota root may be shared by many mailboxes, which allows all the mailboxes to share the same resource limits. In response to the GETQUOTAROOT command, the server sends a QUOTAROOT response that lists all the quota roots, plus a QUOTA response for each quota root. The GETQUOTAROOT command is an optional IMAP4 command. An IMAP4 server that supports the GETQUOTAROOT command returns the QUOTA keyword in its CAPABILITY response.
|
|
||||||||||||
|
Sends the LIST command. The LIST command requests the server to return a list of all names that match a specified pattern. In response, the server sends zero or more LIST responses.
|
|
||||||||||||
|
Sends the LOGIN command. The LOGIN command sends a user name and password for client authentication. LOGIN may not be secure, because it sends the user name and password across the network. It is safe to use LOGIN after you have established a TLS connection. However, if you do not use TLS, you should consider using AUTHENTICATE CRAM-MD5 for authentication, since AUTHENTICATE CRAM-MD5 does not send the password over the network.
|
|
|
Sends the LOGOUT command. The LOGOUT command ends the current IMAP4 session. In response to the LOGOUT command, the IMAP4 server sends a BYE response and then closes the connection. Therefore, after you call Logout, you must call Connect again to reconnect to the server before you can call any member functions that send commands.
|
|
||||||||||||
|
Sends the LSUB command. The LSUB command is similar to the LIST command, except that the server returns only names that are in the list of subscribed mailboxes.
|
|
|
Sends the NAMESPACE command. The NAMESPACE command is an optional IMAP4 command, which is not supported by all IMAP4 servers. If an IMAP4 server supports the NAMESPACE command, then it sends the NAMESPACE keyword in its CAPABILITIES response. If the IMAP4 server accepts the NAMESPACE command, then it sends a NAMESPACE response with information about mailbox namespaces. See the introduction to the NamespaceResponse class for more information about the NAMESPACE command.
|
|
|
Sends the NOOP command. The NOOP command is typically used to obtain notification responses, such as the RECENT response, from the IMAP4 server. (The RECENT response notifies the client that new mail has arrived.) The NOOP command is also used sometimes to keep the connection open for a long period of time. (Most IMAP4 servers will close the connection after a long period of inactivity.) Note: NOOP is an abbreviation for "no operation".
|
|
|
Gets the number of responses received from the server. The Imap4Client object has a collection of Response objects, one for each response received from the server after the last client command. Use this function to get the number of responses in the collection. Use ResponseAt to get the individual responses.
|
|
|
Gets the platform-specific error code for the last error. This function gets the error code reported by the operating system. The operating system's error code is necessarily platform-specific. This error code is probably not as useful as the platform-independent error code, but it might provide information helpful for debugging. The operating system's error code provides more specific information when the platform-independent error code is SYSTEM_ERROR. Not all errors have an operating system error code. Some errors, such as library usage errors, are detected in the Hunny Mail++ library itself.
|
|
|
Sends the PROXYAUTH command. PROXYAUTH is a proprietary IMAP4 extension supported by Netscape/iPlanet/SunONE mail servers. It permits a user with administrator privileges to act on the account of an ordinary user.
|
|
||||||||||||
|
Sends the RENAME command. The RENAME command requests the server to change the name of an existing mailbox.
|
|
|
Gets the response at the specified position. The Imap4Client object has a collection of Response objects, one for each response received from the server after the last client command. You may use this function to get a reference to the Response object at position index. The argument index must satisfy the condition 0 <= index < NumResponses(). Because Response is an abstract base class, the returned object reference actually references a subclass of Response.
|
|
||||||||||||
|
Sends the SEARCH command. The SEARCH command requests the server to return a list of messages that match the specified search criteria. The search criteria can be quite complex. See the documentation in RFC 3501. In response to the SEARCH command, the server sends a SEARCH response, which contains a list of sequence numbers for the messages that satisfy the search criteria.
|
|
|
Sends the SELECT command. The SELECT command takes one parameter: the name of a mailbox (often called a mail "folder"). In response to the SELECT command, the server sends a FLAGS response, an EXISTS response, and a RECENT response. The server may also send untagged OK responses with UNSEEN or PERMANENTFLAGS response codes.
|
|
||||||||||||
|
Sends the SETQUOTA command. The SETQUOTA command allows an administrator to set or change the quota limits at the IMAP4 server. The SETQUOTA command takes a quota root name and a list of resource limits as parameters. In response to the SETQUOTA command, the server sends a QUOTA response that reports the new values of the resource limits. The SETQUOTA command is an optional IMAP4 command. An IMAP4 server that supports the SETQUOTA command returns the QUOTA keyword in its CAPABILITY response.
|
|
|
Sets the timeout for network receive operations. The library supports separate timeout values for sending and receiving. This property affects the timeout for receive operations. The send timeout property affects the timeout for connect and send operations. If a network operation times out, the member function that was executing returns -1, and ErrorCode() returns TIMED_OUT_ERROR.
|
|
|
Sets the timeout for network send operations. The library supports separate timeout values for sending and receiving. This propery affects the timeout for connect and send operations. The receive timeout property affects the timeout for receive operations. If a network operation times out, the member function that was executing returns -1, and ErrorCode() returns TIMED_OUT_ERROR.
|
|
|
Sets the timeout value for network send and receive operations. The timeout applies to these network operations: connect, receive, and send. If a network operation times out, the member function that was executing returns -1, and ErrorCode() returns TIMED_OUT_ERROR. This member function is deprecated. Use SetReceiveTimeout() and SetSendTimeout() to set network timeouts.
|
|
||||||||||||
|
Sets a TraceOutput instance. When you set a TraceOutput instance, you enable trace output, which may be helpful for debugging. You may set a null value to disable trace output. The Hunny Mail++ library provides a StdTraceOutput class that prints all output to standard output. If you pass a true value for the takeOwnership parameter, then the Imap4Client object has the responsibility to delete the trace output object. On the other hand, if you pass false, then your code must delete the trace output object when it is no longer needed.
|
|
|
Sends the STARTTLS command. The STARTTLS command requests the server to begin a TLS handshake. If the STARTTLS command succeeds, as indicated by a tagged OK response from the server, then you should immediately call ConnectTls() to start the TLS handshake and to establish the secure connection. The STARTTLS IMAP4 command is documented in RFC 2595. Note: You must have Secure Mail++ to use this member function. In standard Mail++, the function returns -1.
|
|
||||||||||||
|
Sends the STATUS command. The STATUS command requests the server to send status information for the specified mailbox. You must specify the requested status data items in the command. In response to the STATUS command, the server sends a STATUS response.
|
|
||||||||||||||||
|
Sends the STORE command. The STORE command requests the server to change the values of the flags for specified messages. In response to the STORE command, the server sends one or more FETCH responses that indicate the new values of the flags. This version of the overloaded member function allows flags for multiple messages to be changed, as specified by a set of message sequence numbers. The set parameter should specify a set of message sequence numbers in the syntax specified in RFC 3501. In this syntax, individual sequence numbers or sequence number ranges are separated by commas, and ranges are specified using a colon.
|
|
||||||||||||||||||||
|
Sends the STORE command. The STORE command requests the server to change the values of the flags for specified messages. In response to the STORE command, the server sends one or more FETCH responses that indicate the new values of the flags. This version of the overloaded member function allows the flags for multiple messages to be changed, as specified by a range of message sequence numbers. The parameter firstMsgNum should be the sequence number of the first message in the range, and lastMsgNum should be the sequence number of the last message in the range.
|
|
||||||||||||||||
|
Sends the STORE command. The STORE command requests the server to change the values of the flags for specified messages. In response to the STORE command, the server sends one or more FETCH responses that indicate the new values of the flags. This version of the overloaded member function allows the flags for a single message to be changed. The parameter msgNum should be the sequence number of the message.
|
|
|
Sends the SUBSCRIBE command. The SUBSCRIBE command requests the server to add a mailbox to the list of subscribed mailboxes for the current user. You may use the LSUB command to get a list of the subscribed mailboxes. You may use the UNSUBSCRIBE command to remove a mailbox from the list of subscribed mailboxes.
|
|
||||||||||||
|
Sends the UID COPY command. The UID COPY command is similar to the COPY command, with one difference: the UID COPY command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows multiple messages to be copied, as specified by a set of message UIDs. The set parameter should specify a set of UIDs in the syntax given in RFC 3501. In this syntax, individual UIDs or UID ranges are separated by commas, and ranges are indicated by a colon.
|
|
||||||||||||||||
|
Sends the UID COPY command. The UID COPY command is similar to the COPY command, with one difference: the UID COPY command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows multiple messages to be copied, as specified by a range of message UIDs. The parameter firstUid should be the UID of the first message in the range, and lastUid should be the UID of the last message in the range.
|
|
||||||||||||
|
Sends the UID COPY command. The UID COPY command is similar to the COPY command, with one difference: the UID COPY command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows one message to be copied. The parameter uid should be the UID of the message.
|
|
||||||||||||
|
Sends the UID FETCH command. The UID FETCH command is similar to the FETCH command, with one difference: the UID FETCH command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows information for multiple messages to be fetched, as specified by a set of message UIDs. The set parameter should specify a set of UIDs in the syntax given in RFC 3501. In this syntax, individual UIDs or UID ranges are separated by commas, and ranges are indicated by a colon.
|
|
||||||||||||||||
|
Sends the UID FETCH command. The UID FETCH command is similar to the FETCH command, with one difference: the UID FETCH command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows information for multiple messages to be fetched, as specified by a range of message UIDs. The parameter firstUid should be the UID of the first message in the range, and lastUid should be the UID of the last message in the range.
|
|
||||||||||||
|
Sends the UID FETCH command. The UID FETCH command is similar to the FETCH command, with one difference: the UID FETCH command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows information for a single message to be fetched. The parameter uid should be the UID of the message.
|
|
||||||||||||
|
Sends the UID SEARCH command. The UID SEARCH command is similar to the SEARCH command, with one difference: when the UID SEARCH command is sent, the server's SEARCH response contains the unique identifiers (UIDs) of the matching messages instead of their sequence numbers.
|
|
||||||||||||||||
|
Sends the UID STORE command. The UID STORE command is similar to the STORE command, with one difference: the UID STORE command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows flags for multiple messages to be changed, as specified by a set of message UIDs. The set parameter should specify a set of UIDs in the syntax given in RFC 3501. In this syntax, individual UIDs or UID ranges are separated by commas, and ranges are indicated by a colon.
|
|
||||||||||||||||||||
|
Sends the UID STORE command. The UID STORE command is similar to the STORE command, with one difference: the UID STORE command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows the flags for multiple messages to be changed, as specified by a range of message UIDs. The parameter firstUid should be the UID of the first message in the range, and lastUid should be the UID of the last message in the range.
|
|
||||||||||||||||
|
Sends the UID STORE command. The UID STORE command is similar to the STORE command, with one difference: the UID STORE command specifies messages by their unique identifiers (UIDs) instead of their sequence numbers. This version of the overloaded member function allows flags for a single message to be changed. The parameter uid should be the UID of the message.
|
|
|
Sends the UNSUBSCRIBE command. The UNSUBSCRIBE command requests the server to remove a mailbox from the list of subscribed mailboxes for the current user. You may use the LSUB command to get a list of the subscribed mailboxes. You may use the SUBSCRIBE command to add a mailbox to the list of subscribed mailboxes.
|
Copyright © 2001-2005 Hunny Software, Inc. All rights reserved.