rfc1064.txt
来自「RFC 的详细文档!」· 文本 代码 · 共 1,459 行 · 第 1/4 页
TXT
1,459 行
<-- A003 OK Fetch complete
{Wait for command}
A004 FETCH 8 RFC822.TEXT -->
<-- * 8 Fetch (RFC822.TEXT {893}
...893 characters of text...
<-- )
<-- A004 OK Fetch complete
{Wait for command}
A005 STORE 8 +Flags \Deleted -->
<-- * 8 Store (Flags (\Deleted
\Seen))
<-- A005 OK Store complete
{Wait for command}
A006 EXPUNGE -->
<-- * 19 EXISTS
<-- * 8 EXPUNGE
<-- * 18 EXISTS
<-- A006 Expunge complete
{Wait for command}
A007 LOGOUT -->
<-- * BYE IMAP2 server quitting
<-- A007 OK Logout complete
{Close Connection} --><-- {Close connection}
{Go back to start}
Crispin [Page 7]
RFC 1064 IMAP2 July 1988
Conventions
The following terms are used in a meta-sense in the syntax
specification below:
An ASCII-STRING is a sequence of arbitrary ASCII characters.
An ATOM is a sequence of ASCII characters delimited by SP or CRLF.
A CHARACTER is any ASCII character except """", "{", CR, LF, "%",
or "\".
A CRLF is an ASCII carriage-return character followed immediately
by an ASCII linefeed character.
A NUMBER is a sequence of the ASCII characters which represent
decimal numerals ("0" through "9"), delimited by SP, CRLF, ",", or
":".
A SP is the ASCII space character.
A TEXT_LINE is a human-readable sequence of ASCII characters up to
but not including a terminating CRLF.
One of the most common fields in the IMAP2 protocol is a STRING,
which may be an ATOM, QUOTED-STRING (a sequence of CHARACTERs inside
double-quotes), or a LITERAL. A literal consists of an open brace
("{"), a number, a close brace ("}"), a CRLF, and then an ASCII-
STRING of n characters, where n is the value of the number inside the
brace. In general, a string should be represented as an ATOM or
QUOTED-STRING if at all possible. The semantics for QUOTED-STRING or
LITERAL are checked before those for ATOM; therefore an ATOM used in
a STRING may only contain CHARACTERs. Literals are most often sent
from the server to the client; in the rare case of a client to server
literal there is a special consideration (see the "+ text" response
below).
Another important field is the SEQUENCE, which identifies a set of
messages by consecutive numbers from 1 to n where n is the number of
messages in the mailbox. A sequence may consist of a single number,
a pair of numbers delimited by colon indicating all numbers between
those two numbers, or a list of single numbers and/or number pairs.
For example, the sequence 2,4:7,9,12:15 is equivalent to
2,4,5,6,7,9,12,13,14,15 and identifies all of those messages.
Crispin [Page 8]
RFC 1064 IMAP2 July 1988
Definitions of Commands and Responses
Summary of Commands and Responses
Commands || Responses
-------- || -------
tag NOOP || tag OK text
tag LOGIN user password || tag NO text
tag LOGOUT || tag BAD text
tag SELECT mailbox || * message_number data
tag CHECK || * FLAGS flag_list
tag EXPUNGE || * SEARCH sequence
tag COPY sequence mailbox || * BYE text
tag FETCH sequence data || * OK text
tag STORE sequence data value || * NO text
tag SEARCH search_program || * BAD text
|| + text
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 which 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 which 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 indicates the client is done with the session.
The server sends an unsolicited BYE response before the (tagged)
OK response, and then closes the connection.
tag SELECT mailbox
The SELECT command selects a particular mailbox. The server must
Crispin [Page 9]
RFC 1064 IMAP2 July 1988
check that the user is permitted read access to this mailbox.
Prior to returning an OK to the client, the server must send an
unsolicited FLAGS and <n> EXISTS response to the client giving the
flags list for this mailbox (simply the system flags if this
mailbox doesn't have any special flags) and the number of messages
in the mailbox. It is also recommended that the server send a <n>
RECENT unsolicited response to the client for the benefit of
clients which make use of the number of new messages in a mailbox.
Multiple SELECT commands are permitted in a session, in which case
the prior mailbox is deselected first.
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).
EXAMPLE: A002 SELECT INBOX selects the default mailbox.
tag CHECK
The CHECK command forces a check for new messages and a rescan of
the mailbox for internal change for those implementations which
allow multiple simultaneous read/write access to the same mailbox
(e.g., TOPS-20). It is recommend that periodic implicit checks
for new mail be done by servers as well. The server should send
an unsolicited <n> EXISTS response prior to 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. Prior to
returning an OK to the client, for each message which is removed,
an unsolicited <n> EXPUNGE response is sent indicating which
message was removed. The message number of each subsequent
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 "* 5 EXPUNGE" responses. To ensure mailbox
integrity and server/client synchronization, it is recommended
that the server do an implicit check prior to 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.
Crispin [Page 10]
RFC 1064 IMAP2 July 1988
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. Prior to returning an OK to the
client, the server should return an unsolicited <n> COPY response
for each message copied. A copy should set the \SEEN flag for all
messages which 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)
Crispin [Page 11]
RFC 1064 IMAP2 July 1988
FLAGS The flags which are set for this message.
This may include the following system flags:
\RECENT Message arrived since
last read of this mail
file
\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.
RFC822.HEADER The RFC 822 format header of the message.
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.
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.
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.
Crispin [Page 12]
RFC 1064 IMAP2 July 1988
-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 which match
the given set of criteria. The unsolicited SEARCH <1#number>
response from the server is a list of messages which express the
intersection (AND function) of all the messages. 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.
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.
Crispin [Page 13]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?