Commands Valid in the Selected State

CHECK

The CHECK command performs server- or mailstore-dependent mailbox housekeeping not normally performed as part of each IMAP command (also known as a checkpoint).

Usage

CHECK

Arguments

None

Untagged server responses

None

Results

OK (CHECK completed)
BAD (command unknown or invalid arguments)

Example

A00002 CHECK
A00002 OK Completed

CLOSE

The CLOSE command removes from the currently selected mailbox all messages that have the \\Deleted flag set and returns the user from the selected state back to the authenticated state. Unlike the EXPUNGE command, no untagged EXPUNGE responses are sent for the removed messages by the CLOSE command.

Usage

CLOSE

Arguments

None

Untagged server responses

None

Results

OK (CLOSE completed successfully)
NO (No mailbox selected: CLOSE command failed)
BAD (command unknown or invalid arguments)

Example

A00008 CLOSE
A00008 OK Completed

COPY

The COPY command copies the specified messages from the selected mailbox into the specified mailbox.

Usage

COPY message-set mailbox

Arguments

Set of messages to copy
Name of target mailbox

Untagged server responses

None

Results

OK (successfully copied)
NO (COPY command failed)
BAD (command unknown or invalid arguments)

Example

A00322 COPY 1:5 saved-messages
A00322 OK Completed

EXPUNGE

The EXPUNGE command permanently removes all messages that have the \\Deleted flag set from the selected mailbox.

Usage

EXPUNGE

Arguments

None

Untagged server responses

One or more untagged EXPUNGE responses

Results

OK (EXPUNGE completed successfully) ...

Get Managing IMAP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.