Skip to main content

Commands

tag NOOP​

The NOOP command returns an OK to the client. By itself, it does nothing, but certain things may happen as side effects. For example, server implementations that implicitly check the mailbox for new mail may do so as a result of this command. The primary use of this command is to for the client to see if the server is still alive (and notify the server that the client is still alive, for those servers that have inactivity autologout timers).

tag LOGIN user password​

The LOGIN command identifies the user to the server and carries the password authenticating this user. This information is used by the server to control access to the mailboxes.

EXAMPLE:  A001 LOGIN SMITH SESAME
logs in as user SMITH with password SESAME.

tag LOGOUT​

The LOGOUT command informs the server that the client is done with the session. The server should send an unsolicited BYE response before the (tagged) OK response, and then close the network connection.

tag SELECT mailbox​

The SELECT command selects a particular mailbox. The server must check that the user is permitted read access to this mailbox. Before returning an OK to the client, the server must send the following unsolicited data to the client:

  • FLAGS: mailbox's defined flags
  • EXISTS: the number of messages in the mailbox
  • RECENT: the number of new messages in the mailbox

in order to define the initial state of the mailbox at the client.

Multiple SELECT commands are permitted in a session, in which case the previous mailbox is automatically deselected when a new SELECT is made.

The default mailbox for the SELECT command is INBOX, which is a special name reserved to mean "the primary mailbox for this user on this server". The format of other mailbox names is operating system dependent (as of this writing, it reflects the filename path of the mailbox file on the current servers).

It is customary, although not required, for the text of an OK response to the SELECT command to begin with either "[READ-ONLY]" or "[READ-WRITE]" to show the mailbox's access status.

EXAMPLE: A002 SELECT INBOX
selects the default mailbox.

tag BBOARD bulletin_board​

The BBOARD command is equivalent to SELECT, and returns the same output. However, it differs from SELECT in that its argument is a shared mailbox (bulletin board) name instead of an ordinary mailbox. The format of a bulletin name is implementation specific, although it is strongly encouraged to use something that resembles a name in a generic sense and not a file or mailbox name on the particular system. There is no requirement that a bulletin board name be a mailbox name or a file name (in particular, Unix netnews has a completely different namespace from mailbox or file names).

Support for BBOARD is optional.

tag FIND MAILBOXES pattern​

The FIND MAILBOXES command accepts as an argument a pattern (including wildcards) that specifies some set of mailbox names that are usable by the SELECT command. The format of mailboxes is implementation dependent. The special mailbox name INBOX is not included in the output.

Two wildcard characters are defined; "" specifies any number (including zero) characters may match at this position and "%" specifies a single character may match at this position. For example, FOOBAR will match FOOBAR, FOOD.ON.THE.BAR and FOO.BAR, whereas FOO%BAR will match only FOO.BAR. "*" will match all mailboxes.

The FIND MAILBOXES command will return some set of unsolicited MAILBOX replies that have as their value a single mailbox name.

EXAMPLE:  A002 FIND MAILBOXES *
* MAILBOX FOOBAR
* MAILBOX GENERAL
A002 FIND completed

Although the use of explicit file or path names for mailboxes is discouraged by this standard, it may be unavoidable. It is important that the value returned in the MAILBOX unsolicited reply be usable in the SELECT command without remembering any path specification that may have been used in the FIND MAILBOXES pattern.

Support for FIND MAILBOXES is optional. If a client's attempt returns BAD as a response then the client can make no assumptions about what mailboxes exist on the server other than INBOX.

tag FIND BBOARDS pattern​

The FIND BBOARDS command accepts as an argument a pattern that specifies some set of bulletin board names that are usable by the BBOARD command. Wildcards are permitted as in FIND MAILBOXES.

The FIND BBOARDS command will return some set of unsolicited BBOARD replies that have as their value a single bulletin board name.

EXAMPLE:  A002 FIND BBOARDS *
* BBOARD FOOBAR
* BBOARD GENERAL
A002 FIND completed

Support for FIND BBOARDS is optional. If a client's attempt returns BAD as a response then the client can make no assumptions about what bulletin boards exist on the server, or that they exist at all.

tag CHECK​

The CHECK command forces a check for new messages and a rescan of the mailbox for internal change for those implementations that allow multiple simultaneous read/write access to the same mailbox. It is recommend that periodic implicit checks for new mail be done by servers as well. The server should send unsolicited EXISTS and RECENT responses with the current status before returning an OK to the client.

tag EXPUNGE​

The EXPUNGE command permanently removes all messages with the \DELETED flag set in its flags from the mailbox. Before returning an OK to the client, for each message that is removed, an unsolicited EXPUNGE response is sent. The message number for each successive message in the mailbox is immediately decremented by 1; this means that if the last 5 messages in a 9-message mail file are expunged you will receive 5 unsolicited EXPUNGE responses for message 5. To ensure mailbox integrity and server/client synchronization, it is recommended that the server do an implicit check before commencing the expunge and again when the expunge is completed. Furthermore, if the server allows multiple simultaneous access to the same mail file the server must lock the mail file for exclusive access while an expunge is taking place.

EXPUNGE is not allowed if the user does not have write access to this mailbox.

tag COPY sequence mailbox​

The COPY command copies the specified message(s) to the specified destination mailbox. If the destination mailbox does not exist, the server should create it. Before returning an OK to the client, the server should return an unsolicited COPY response for each message copied. A copy should set the \SEEN flag for all messages that were successfully copied (provided, of course, that the user has write access to this mailbox).

EXAMPLE:  A003 COPY 2:4 MEETING
copies messages 2, 3, and 4 to mailbox "MEETING".

COPY is not allowed if the user does not have write access to the destination mailbox.

tag FETCH sequence data​

The FETCH command retrieves data associated with a message in the mailbox. The data items to be fetched may be either a single atom or an S-expression list. The currently defined data items that can be fetched are:

  • ALL: Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE)
  • ENVELOPE: The envelope of the message. The envelope is computed by the server by parsing the RFC 822 header into the component parts, defaulting various fields as necessary.
  • FAST: Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE)
  • FLAGS: The flags that are set for this message. This may include the following system flags:
    • \RECENT: Message arrived since the previous time this mailbox was read
    • \SEEN: Message has been read
    • \ANSWERED: Message has been answered
    • \FLAGGED: Message is "flagged" for urgent/special attention
    • \DELETED: Message is "deleted" for removal by later EXPUNGE
  • INTERNALDATE: The date and time the message was written to the mailbox.
  • RFC822: The message in RFC 822 format. The \SEEN flag is implicitly set; if this causes the flags to change they should be included as part of the fetch results. This is the concatenation of RFC822.HEADER and RFC822.TEXT.
  • RFC822.HEADER: The "raw" RFC 822 format header of the message as stored on the server.
  • RFC822.SIZE: The number of characters in the message as expressed in RFC 822 format.
  • RFC822.TEXT: The text body of the message, omitting the RFC 822 header. The \SEEN flag is implicitly set as with RFC822 above.
EXAMPLES:
A003 FETCH 2:4 ALL
fetches the flags, internal date, RFC 822 size, and envelope
for messages 2, 3, and 4.
A004 FETCH 3 RFC822
fetches the RFC 822 representation for message 3.
A005 FETCH 4 (FLAGS RFC822.HEADER)
fetches the flags and RFC 822 format header for message 4.

Note: An attempt to FETCH already-transmitted data may have no result. See the Implementation Discussion below.

tag STORE sequence data value​

The STORE command alters data associated with a message in the mailbox. The currently defined data items that can be stored are:

  • FLAGS: Replace the flags for the message with the argument (in flag list format).
  • +FLAGS: Add the flags in the argument to the message's flag list.
  • -FLAGS: Remove the flags in the argument from the message's flag list.

STORE is not allowed if the user does not have write access to this mailbox.

EXAMPLE:  A003 STORE 2:4 +FLAGS (\DELETED)
marks messages 2, 3, and 4 for deletion.

tag SEARCH search_criteria​

The SEARCH command searches the mailbox for messages that match the given set of criteria. The unsolicited SEARCH <1#number> response from the server is a list of messages that express the intersection (AND function) of all the messages which match that criteria. For example, A003 SEARCH DELETED FROM "SMITH" SINCE 1-OCT-87 returns the message numbers for all deleted messages from Smith that were placed in the mail file since October 1, 1987.

In all search criteria which use strings, a message matches the criteria if the string is a case-independent substring of that field. The currently defined criteria are:

  • ALL: All messages in the mailbox; the default initial criterion for ANDing.
  • ANSWERED: Messages with the \ANSWERED flag set.
  • BCC string: Messages which contain the specified string in the envelope's BCC field.
  • BEFORE date: Messages whose internal date is earlier than the specified date.
  • BODY string: Messages which contain the specified string in the body of the message.
  • CC string: Messages which contain the specified string in the envelope's CC field.
  • DELETED: Messages with the \DELETED flag set.
  • FLAGGED: Messages with the \FLAGGED flag set.
  • FROM string: Messages which contain the specified string in the envelope's FROM field.
  • KEYWORD flag: Messages with the specified flag set.
  • NEW: Messages which have the \RECENT flag set but not the \SEEN flag. This is functionally equivalent to "RECENT UNSEEN".
  • OLD: Messages which do not have the \RECENT flag set.
  • ON date: Messages whose internal date is the same as the specified date.
  • RECENT: Messages which have the \RECENT flag set.
  • SEEN: Messages which have the \SEEN flag set.
  • SINCE date: Messages whose internal date is later than the specified date.
  • SUBJECT string: Messages which contain the specified string in the envelope's SUBJECT field.
  • TEXT string: Messages which contain the specified string.
  • TO string: Messages which contain the specified string in the envelope's TO field.
  • UNANSWERED: Messages which do not have the \ANSWERED flag set.
  • UNDELETED: Messages which do not have the \DELETED flag set.
  • UNFLAGGED: Messages which do not have the \FLAGGED flag set.
  • UNKEYWORD flag: Messages which do not have the specified flag set.
  • UNSEEN: Messages which do not have the \SEEN flag set.