Share this page

# imap_list_mailboxes

Internet Messaging Functions (IMAP)

Lists the available mailboxes.

    int imap_list_mailboxes( char *transaction, char *reference, char *name, LAST );

transaction | A transaction name for this step in quotes. To avoid creating a transaction for this step, use a null string, "".
reference | The location or path of the mailbox in the following format: Reference=reference name
name | The names of the desired mailboxes. You can use wildcards, *, together with partial mailbox names. For example: "MatchName=comp.mail.*"
LAST | A marker indicating the end of the argument list.

The imap_list_mailboxes function lists the mailboxes that are available to the client. The reply contains the name attributes, hierarchy delimiter, and mailbox names.

The following table shows how references and mailbox names might be interpreted on a Linux-based server:

Reference | Mailbox Name | Interpretation
--- | --- | ---
`~smith/Mail/` | `foo.*` | `~smith/Mail/foo.*`
`archive/` | `%` | `archive/%`
`#news.` | `comp.mail.*` | `news.comp.mail.`
`~smith/Mail/` | `/usr/doc/foo` | `usr/doc/foo`
`archive/` | `fred/Mail` | `fred/Mail`

The first three examples demonstrate how reference arguments are interpreted. The character "*" is a wildcard, and matches zero or other characters.

This function is for use with global sessions. For multiple sessions, use the imap_list_mailboxes_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.

## Example

In the following example, the imap_list_mailboxes function gets a list of the messages and saves the message count to a variable.

        imap_list_mailboxes("ListMailboxes",
                "Reference=#news.",
                "MatchName=comp.mail.*",
                LAST );

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