Yoonadev

Mail

IMAP Command Builder

IMAP Commands

Build IMAP commands for mailbox management, search, messages and flags.

Usage guide & examples

Choose a command to see its purpose, arguments and example. Generate it below, then enter it in a connected IMAP client. Use a new tag for each command. LOGIN requires verified TLS.

FETCH can combine several items. BODY[] may set \Seen in a read-write mailbox; BODY.PEEK[] retrieves without setting it. MIME part and header retrieval also use PEEK. STORE changes flags; DELETE removes a mailbox; CLOSE/EXPUNGE can permanently remove messages marked \Deleted.

IMAP connection guide

CAPABILITY · Command help & example

Discover supported extensions before login or choosing features.

Arguments: —

A001 CAPABILITY
LOGIN · Command help & example

Authenticate with username/password over verified TLS. Check LOGINDISABLED first.

Arguments: username, password

A001 LOGIN "user" "password"
LOGOUT · Command help & example

End the connection when finished.

Arguments: —

A001 LOGOUT
NOOP · Command help & example

Poll for mailbox updates while keeping the session active.

Arguments: —

A001 NOOP
LIST · Command help & example

Discover available mailboxes with a reference path and wildcard pattern.

Arguments: reference path, mailbox pattern

A001 LIST "" "*"
LSUB · Command help & example

List subscribed mailboxes on IMAP4rev1 servers; check server support.

Arguments: reference path, mailbox pattern

A001 LSUB "" "*"
SELECT · Command help & example

Select a mailbox before message operations; may allow writes.

Arguments: mailbox

A001 SELECT "INBOX"
EXAMINE · Command help & example

Open a mailbox read-only for inspection.

Arguments: mailbox

A001 EXAMINE "INBOX"
STATUS · Command help & example

Inspect mailbox counters without selecting it.

Arguments: mailbox

A001 STATUS "INBOX" (MESSAGES UNSEEN UIDNEXT UIDVALIDITY)
SEARCH · Command help & example

Find matching messages in the selected mailbox; returns sequence numbers.

Arguments: search criterion; search text for TEXT/FROM/TO/SUBJECT

A001 SEARCH TEXT "invoice"
FETCH · Command help & example

Retrieve chosen message attributes or content from a selected mailbox.

Arguments: sequence set, FETCH items; MIME part / header names when chosen

A001 FETCH 1 BODYSTRUCTURE
STORE · Command help & example

Add (+), remove (-), or replace flags; SILENT suppresses the updated flag reply.

Arguments: sequence set, flag operation, system flag; custom flags optional

A001 STORE 1 +FLAGS (\Seen)
COPY · Command help & example

Copy selected messages to another mailbox after selecting the source.

Arguments: sequence set, destination mailbox

A001 COPY 1:5 "Archive"
APPEND · Command help & example

Upload a complete MIME message to a mailbox. Wait for + before sending literal bytes.

Arguments: mailbox, MIME message

A001 APPEND "INBOX" {22}
Subject: Test

Hello
CREATE · Command help & example

Create a new mailbox after authentication.

Arguments: mailbox

A001 CREATE "Archive"
DELETE · Command help & example

Delete the named mailbox and its contents according to server semantics.

Arguments: mailbox

A001 DELETE "Old"
RENAME · Command help & example

Change a mailbox name after authentication.

Arguments: mailbox, destination mailbox

A001 RENAME "Old" "New"
SUBSCRIBE · Command help & example

Add a mailbox to the subscription list.

Arguments: mailbox

A001 SUBSCRIBE "Archive"
UNSUBSCRIBE · Command help & example

Remove a mailbox from the subscription list; keeps the mailbox.

Arguments: mailbox

A001 UNSUBSCRIBE "Archive"
CLOSE · Command help & example

Close the selected mailbox; permanently removes Deleted messages when writable.

Arguments: —

A001 CLOSE
EXPUNGE · Command help & example

Permanently remove all Deleted messages in the selected writable mailbox.

Arguments: —

A001 EXPUNGE
NAMESPACE · Command help & example

Discover personal/shared namespace prefixes and separators when supported.

Arguments: —

A001 NAMESPACE
UID SEARCH · Command help & example

Find matching messages in the selected mailbox; returns sequence numbers. Uses UIDs instead of sequence numbers.

Arguments: search criterion; search text for TEXT/FROM/TO/SUBJECT

A001 UID SEARCH TEXT "invoice"
UID FETCH · Command help & example

Retrieve chosen message attributes or content from a selected mailbox. Uses UIDs instead of sequence numbers.

Arguments: UID set, FETCH items; MIME part / header names when chosen

A001 UID FETCH 1 BODYSTRUCTURE
UID STORE · Command help & example

Add (+), remove (-), or replace flags; SILENT suppresses the updated flag reply. Uses UIDs instead of sequence numbers.

Arguments: UID set, flag operation, system flag; custom flags optional

A001 UID STORE 1 +FLAGS (\Seen)
UID COPY · Command help & example

Copy selected messages to another mailbox after selecting the source. Uses UIDs instead of sequence numbers.

Arguments: UID set, destination mailbox

A001 UID COPY 1:5 "Archive"

Processed locally. No input is uploaded or stored.

Scope

Enter commands in a connected IMAP client. Authenticate first where required; SEARCH/FETCH/STORE/COPY/CLOSE/EXPUNGE require a selected mailbox. Check the matching tag for OK, NO or BAD. UID commands use stable UIDs, not sequence numbers.

SEARCH v1 supports ASCII text. Non-ASCII mailbox names can be converted using the Modified UTF-7 tool.

Find a tool

↑ ↓ to select · Enter to open · Esc to close