imap_get_result_ex
| Internet Messaging Functions (IMAP) |
Gets an IMAP server return code, for a specific session.
int imap_get_result_ex( IMAP *ppimap );
| ppimap | A session identifier. |
The imap_get_result_ex function gets an IMAP server return code for a specific server session. You use this function to determine the error code issued by the IMAP server for the previous IMAP function.
The following table shows the possible return codes:
| Error Code | Value | Description |
|---|---|---|
| IMAP_OK | 1 | The function succeeded. |
| IMAP_NO | 2 | Function execution was denied. |
| IMAP_BAD | 3 | The arguments that were passed were either invalid or not allowed. |
| IMAP_BYE | 4 | The server closed the connection. |
| IMAP_PREAUTH | 5 | The client connected to the server that was previously authenticated. |
| IMAP_TIMEOUT | -1 | The IMAP operation failed to return a result. |
| IMAP_DISCONNECTED | -2 | The IMAP session is no longer connected to the server. |
| IMAP_NOSESSION | -3 | No IMAP session exists—no session was created. |
| IMAP_INVALID | -4 | Invalid client-side arguments were used in the imap_* function. |
This function is for use with multiple sessions. For global sessions, use the imap_get_result function, which leaves out the session identifier.
Return Values
If this function succeeds, it returns LR_PASS. Otherwise, it returns LR_FAIL.
Parameterization
Standard parameterization is not available for this function.
Example
In the following example, the imap_get_result_ex function gets the IMAP error code for imap_store.
if (imap_store(....) == LR_FAIL) {
int reason = imap_get_result_ex(&imap1);
if (reason == IMAP_BAD) {
// Bad command sent to server...
} else if (reason == IMAP_NO) {
// Not allowed to perform store operation
}
}

