Provided by Colasoft Co., Ltd.

IMAP ( Interactive Mail Access Protocol )

Home > Protocols > IMAP Update: 2005-11-10 16:00:30    I have words to say about this protocol
On this page
SUMMARY
Protocol : Interactive Mail Access Protocol
Protocol suite : TCP/IP
Layer : Application Layer
Type : Email protocol
Latest Version : IMAP4
Ports : 143 (TCP) IMAP2, IMAP4, IMAP 4rev1; 220 (TCP) IMAP3
Related protocols : POP,
SMTP
URI : imap
Working groups : Imap, Internet Message Access Protocol.
Imapext, Internet Message Access Protocol Extension.
DESCRIPTION
IMAP (Internet Message Access Protocol) is a standard protocol for accessing e-mail from your local server. IMAP is a client/server protocol in which e-mail is received and held for you by your Internet server. You (or your e-mail client) can view just the heading and the sender of the letter and then decide whether to download the mail. You can also create and manipulate multiple folders or mailboxes on the server, delete messages, or search for certain parts or an entire note. IMAP requires continual access to the server during the time that you are working with your mail.

Key goals for IMAP include
  • Be fully compatible with Internet messaging standards, e.g. MIME.

  • Allow message access and management from more than one computer.

  • Allow access without reliance on less efficient file access protocols.

  • Provide support for "online", "offline", and "disconnected" access modes.

  • Support for concurrent access to shared mailboxes.
  • Client software needs no knowledge about the server's file store format.


IMAP's ability to access messages (both new and saved) from more than one computer has become extremely important as reliance on electronic messaging and use of multiple computers increase, but this functionality cannot be taken for granted: the widely used Post Office Protocol (POP) works best when one has only a single computer, since it was designed to support "offline" message access, wherein messages are downloaded and then deleted from the mail server. This mode of access is not compatible with access from multiple computers since it tends to sprinkle messages across all of the computers used for mail access. Thus, unless all of those machines share a common file system, the offline mode of access that POP was designed to support effectively ties the user to one computer for message storage and manipulation.

POP3 and IMAP deal with the receiving of e-mail from your local server and are not to be confused with Simple Mail Transfer Protocol (SMTP), a protocol used for exchanging e-mail between points on the Internet. Typically, SMTP is used for sending only and POP3 or IMAP are used to read e-mail.

The IMAP protocol attempts to remedy some of these problems. The strength of IMAP lies in online and disconnected operation. Unlike POP3, mail is not copied from the server and then deleted - instead, IMAP clients manipulate the mail on the server, and permit access to remote, server hosted mailboxes as though they were local resources.
  • An IMAP mail system has a number of immediate advantages for users.


  • As all mail is stored on the server, changing mail client becomes the work of seconds - all that is required is to configure a new IMAP client with the IMAP account details.


  • An IMAP client can easily be configured to view multiple mailboxes in physically separate servers.


  • Multiple IMAP clients can be used by each user. This makes implementing a webmail solution for roaming users a simple task.


  • IMAP maintains message status flags on the server for read, answered, etc.


  • IMAP allows the idea of shared folders. This makes it easier to implement generic email accounts for an organisation, and then allow multiple users to access those accounts.


  • Many implementations also allow server side filtering of mail. This can be an extremely useful feature when users are accessing their mailboxes through different email clients.

The IMAP4rev1 protocol assumes a reliable data stream such as that provided by TCP. When TCP is used, an IMAP4rev1 server listens on port 143.

IMAP4 includes operations for creating, deleting, and renaming mailboxes; checking for new messages; permanently removing messages; setting and clearing flags; parsing; searching; and selective fetching of message attributes, texts, and portions thereof. Messages in IMAP4 are accessed by the use of numbers. These numbers are either message sequence numbers or unique identifiers.


Commands
CommandDescription
APPENDAppends the literal argument as a new message to the end of the specified destination mailbox.
AUTHENTICATEIndicates a [SASL] authentication mechanism to the server.
CAPABILITYRequests a listing of capabilities that the server supports.
CHECKRequests a checkpoint of the currently selected mailbox.
CLOSEIt permanently removes all messages that have the Deleted flag set from the currently selected mailbox, and returns to the authenticated state from the selected state.
DELETEACLThe DELETEACL command removes any pair for the specified identifier from the access control list for the specified mailbox.
FETCHRetrieves data associated with a message in the mailbox.
GETACLReturns the access control list for mailbox in an untagged ACL reply.
GETQUOTATakes the name of a quota root and returns the quota root"s resource usage and limits in an untagged QUOTA response.
LISTReturns a subset of names from the complete set of all names available to the client.
LISTRIGHTSTakes a mailbox name and an identifier and returns information
LSUBReturns a subset of names from the set of names that the user has declared as being "active" or "subscribed".
NOOPBe used as a periodic poll for new messages or message status updates during a period of inactivity
UIDIt takes as its arguments a COPY, FETCH, or STORE command with arguments appropriate for the associated command and SEARCH command with SEARCH command arguments.

Status Responses
Status responses MAY include an OPTIONAL response code. A response code consists of data inside square brackets in the form of an atom, possibly followed by a space and arguments. The response code contains additional information or status codes for client software beyond the OK/NO/BAD condition, and are defined when there is a specific action that a client can take based upon the additional information.

Top of Page

EXAMPLES
Example 1: Client Commands - Experimental/Expansion


X Command
Arguments: implementation defined
Responses: implementation defined
Result: OK - command completed
NO - failure
BAD - command unknown or arguments invalid

Any command prefixed with an X is an experimental command. Commands which are not part
of this specification, a standard or standards-track revision of this specification, or
an IESG-approved experimental protocol, MUST use he X prefix.

Any added untagged responses issued by an experimental command MUST also be prefixed
with an X. Server implementations MUST NOT send any such untagged responses, unless
the client requested it by issuing the associated experimental command.

C: a441 CAPABILITY
S: * CAPABILITY IMAP4rev1 XPIG-LATIN
S: a441 OK CAPABILITY completed
C: A442 XPIG-LATI
S: * XPIG-LATIN ow-nay eaking-spay ig-pay atin-lay
S: A442 OK XPIG-LATIN ompleted-cay
Example 2: Sample IMAP4rev1 connection


The following is a transcript of an IMAP4rev1 connection. A long line in this sample
is broken for editorial clarity.

S: * OK IMAP4rev1 Service Ready
C: a001 login mrc secret
S: a001 OK LOGIN completed
C: a002 select inbox
S: * 18 EXISTS
S: * FLAGS (Answered Flagged Deleted Seen Draft)
S: * 2 RECENT
S: * OK [UNSEEN 17] Message 17 is the first unseen message
S: * OK [UIDVALIDITY 3857529045] UIDs valid
S: a002 OK [READ-WRITE] SELECT completed
C: a003 fetch 12 full
S: * 12 FETCH (FLAGS (Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700"
RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)"
"IMAP4rev1 WG mtg summary and minutes"
(("Terry Gray" NIL "gray" "cac.washington.edu"))
(("Terry Gray" NIL "gray" "cac.washington.edu"))
(("Terry Gray" NIL "gray" "cac.washington.edu"))
((NIL NIL "imap" "cac.washington.edu"))
((NIL NIL "minutes" "CNRI.Reston.VA.US")
("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL
"")
BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028
92))
S: a003 OK FETCH completed
C: a004 fetch 12 body[header]
S: * 12 FETCH (BODY[HEADER] {342}
S: Date: Wed, 17 Jul 1996 02:23:25 -0700 (PDT)
S: From: Terry Gray
S: Subject: IMAP4rev1 WG mtg summary and minutes
S: To: imap@cac.washington.edu
S: cc: minutes@CNRI.Reston.VA.US, John Klensin
S: Message-Id:
S: MIME-Version: 1.0
S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
S:
S: )
S: a004 OK FETCH completed
C: a005 store 12 +flags deleted
S: * 12 FETCH (FLAGS (Seen Deleted))
S: a005 OK +FLAGS completed
C: a006 logout
S: * BYE IMAP4rev1 server terminating connection
S: a006 OK LOGOUT completed
Example 3: Server Responses


The command continuation request response is indicated by a "+" token instead of a tag.
This form of response indicates that the server is ready to accept the continuation of
a command from the client. The remainder of this response is a line of text.

C: A001 LOGIN {11}
S: + Ready for additional command text
C: FRED FOOBAR {7}
S: + Ready for additional command text
C: fat man
S: A001 OK LOGIN completed
C: A044 BLURDYBLOOP {102856}
S: A044 BAD No such command as "BLURDYBLOOP"

Top of Page


PROTOCOL RELATIONS
Parent layer
Child layer
TCP
IMAP
Top of Page

GLOSSARY
MIME
MIME (Multipurpose Internet Mail Extensions) is a specification for formatting non-ASCII messages so that they can be sent over the Internet. Many e-mail clients now support MIME, which enables them to send and receive graphics, audio, and video files via the Internet mail system. In addition, MIME supports messages in character sets other than ASCII.

There are many predefined MIME types, such as GIF graphics files and PostScript files. It is also possible to define your own MIME types.

In addition to e-mail applications, Web browsers also support various MIME types. This enables the browser to display or output files that are not in HTML format.

POP
POP (Post Office Protocol) is a protocol used to retrieve e-mail from a mail server. Most e-mail applications (sometimes called an e-mail client) use the POP protocol, although some can use the newer IMAP (Internet Message Access Protocol). There are two versions of POP. The first, called POP2, became a standard in the mid-80's and requires SMTP to send messages. The newer version, POP3, can be used with or without SMTP.

POP3
POP3 (Post Office Protocol 3) is the most recent version of a standard protocol for receiving e-mail. POP3 is a client/server protocol in which e-mail is received and held for you by your Internet server. Periodically, you (or your client e-mail receiver) check your mail-box on the server and download any mail, probably using POP3. This standard protocol is built into most popular e-mail products, such as Eudora and Outlook Express. It's also built into the Netscape and Microsoft Internet Explorer browsers.

SMTP
SMTP (Simple Mail Transfer Protocol) is a protocol for sending e-mail messages between servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from one server to another; the messages can then be retrieved with an e-mail client using either POP or IMAP. In addition, SMTP is generally used to send messages from a mail client to a mail server. This is why you need to specify both the POP or IMAP server and the SMTP server when you configure your e-mail application.

Top of Page

REFERENCES
Related links:
                IMAP4 capabilities
RFCs:
[RFC 1176] INTERACTIVE MAIL ACCESS PROTOCOL - VERSION 2.
                Obsoletes: RFC 1064.
[RFC 1203] INTERACTIVE MAIL ACCESS PROTOCOL - VERSION 3.
                Obsoletes: RFC 1064.
[RFC 1731] IMAP4 Authentication Mechanisms.
[RFC 1732] IMAP4 COMPATIBILITY WITH IMAP2 AND IMAP2BIS.
[RFC 1733] DISTRIBUTED ELECTRONIC MAIL MODELS IN IMAP4.
[RFC 2061] IMAP4 COMPATIBILITY WITH IMAP2BIS.
[RFC 2062] Internet Message Access Protocol - Obsolete Syntax.
[RFC 2086] IMAP4 ACL extension.
[RFC 2087] IMAP4 QUOTA extension.
[RFC 2088] IMAP4 non-synchronizing literals.
[RFC 2177] IMAP4 IDLE command.
                Defines the IMAP IDLE capability.
[RFC 2180] IMAP4 Multi-Accessed Mailbox Practice.
[RFC 2192] IMAP URL Scheme.
                Defines URI scheme imap.
[RFC 2193] IMAP4 Mailbox Referrals.
[RFC 2195] IMAP/POP AUTHorize Extension for Simple Challenge/Response.
                Obsoletes: RFC 2095.
[RFC 2221] IMAP4 Login Referrals.
[RFC 2342] IMAP4 Namespace.
[RFC 2359] IMAP4 UIDPLUS extension.
[RFC 2595] Using TLS with IMAP, POP3 and ACAP.
[RFC 2683] IMAP4 Implementation Recommendations.
[RFC 2971] IMAP4 ID extension.
[RFC 3348] The Internet Message Action Protocol (IMAP4) Child Mailbox Extension.
[RFC 3501] INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1.
                Defines IMAP4rev1.
                Obsoletes: RFC 2060.
[RFC 3502] Internet Message Access Protocol (IMAP) - MULTIAPPEND Extension.
                Defines the IMAP MULTIAPPEND capability.
[RFC 3503] Message Disposition Notification (MDN) profile for Internet Message Access Protocol (IMAP).
[RFC 3516] IMAP4 Binary Content Extension.
[RFC 3691] Internet Message Access Protocol (IMAP) UNSELECT command.
                Defines the IMAP UNSELECT capability and UNSELECT command.
                


Top of Page

OTHER PROTOCOLS OF TCP/IP SUITE
AARP   RRP   RTP Video   RTP Audio   RTP   COPS   Gopher   HSRP   ICP   MPLS   IEEE 802.2   CIP   FTP - Data   FTP - Ctrl   IMAPS   IP Fragment   LDAPS   PUP   MSSQL   RSH   SQL   POP3s   RTELNET   RSVP   STP   VLAN   MSN   H.323   MSRDP   HTTPS   WINS   LPD   GTP   ICMPv6   POP   TELNET   H.225   VRRP   PIM   RARP   SAP   OSPF   RLOGIN   SCTP   SIP   RTCP   PPPoE   Mobile IP   IMAP3   WhoIs   SLP   NCP   PPTP   MGCP   LDAP   L2TP   Kerberos   IPv6   GRE   Ethernet SNAP   AFP   CIFS   IEEE 802.3   Finger   NBDGM   NetBEUI   NBSSN   ESP   EIGRP   EGP   DHCP   CGMP   CDP   BOOTP   AH   NBNS   EthernetII   ICQ   PPP   ARP   RIP   IPX   IGRP   IGMP   SSH   RPC   NetBIOS   TFTP   SNMP   SNA   SMB   RADIUS   NTP   NNTP   UDP   TCP   BGP   DNS   SOCKS   IMAP   RTSP   NFS   ICMP   IP   FTP   Telnet   POP3   SMTP   HTTP  
Search RFCs:

Advanced Search
Search Glossary:
Exact search
Fuzzy search


All Protocols
Submit a Request

Recommend an Article

 Layer 7 Application Layer
  AFP
  BOOTP
  CIFS
  CIP
  COPS
  DHCP
  DNS
  Finger
  FTP
  FTP - Ctrl
  FTP - Data
  Gopher
  HSRP
  HTTP
  HTTPS
  ICP
  ICQ
  IMAP
  IMAP3
  IMAPS
  Kerberos
  LPD
  MGCP
  MSN
  MSRDP
  MSSQL
  NCP
  NFS
  NNTP
  NTP
  POP
  POP3
  POP3s
  RADIUS
  RLOGIN
  RRP
  RSH
  RTCP
  RTELNET
  RTP
  RTP Audio
  RTP Video
  RTSP
  SAP
  SIP
  SLP
  SMB
  SMTP
  SNA
  SNMP
  SOCKS
  SSH
  Telnet
  TELNET
  TFTP
  WhoIs
  WINS
 Layer 6 Presentation Layer
  NBNS
  NBSSN
  NCP
  NetBIOS
 Layer 5 Session Layer
  LDAP
  LDAPS
  NCP
  NetBEUI
  RPC
 Layer 4 Transport Layer
  H.225
  H.323
  NBDGM
  NetBEUI
  PUP
  SCTP
  TCP
  UDP
 Layer 3 Network Layer
  AARP
  AH
  BGP
  EGP
  EIGRP
  ESP
  GRE
  GTP
  ICMP
  ICMPv6
  IGMP
  IGRP
  IP
  IP Fragment
  IPv6
  IPX
  Mobile IP
  MPLS
  OSPF
  PIM
  PPPoE
  RIP
  RSVP
  STP
  VRRP
 Layer 2 Data Link Layer
  ARP
  CDP
  CGMP
  Ethernet SNAP
  EthernetII
  IEEE 802.2
  IEEE 802.3
  L2TP
  PPP
  PPTP
  RARP
  SQL
  VLAN
 Layer 1 Physical Layer
© 2006 - 2007 Colasoft Co., Ltd. All rights reserved.