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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.