Share this page

# imap_get_result

Internet Messaging Functions (IMAP)

Gets an IMAP server return code.

    int imap_get_result();

The imap_get_result function gets an IMAP server return code. You use this function to determine the exact 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 global sessions. For multiple sessions, use the imap_get_result_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

Standard parameterization is not available for this function.

## Example

In the following example, the imap_get_result function gets the IMAP error code for imap_store.

Copy code

        if (imap_store(....) == LR_FAIL) {
            int reason = imap_get_result();
               if (reason == IMAP_BAD) {
                    // Bad command sent to server...
                  } else if (reason == IMAP_NO) {
                    // Not allowed to perform store operation
              }
        }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: