In computing, the Internet Message Access Protocol (IMAP) is an
Internet standard
In computer network engineering, an Internet Standard is a normative specification of a technology or methodology applicable to the Internet. Internet Standards are created and published by the Internet Engineering Task Force (IETF). They allow ...
protocol
Protocol may refer to:
Sociology and politics
* Protocol (politics), a formal agreement between nation states
* Protocol (diplomacy), the etiquette of diplomacy and affairs of state
* Etiquette, a code of personal behavior
Science and technolog ...
used by
email client
An email client, email reader or, more formally, message user agent (MUA) or mail user agent is a computer program used to access and manage a user's email.
A web application which provides message management, composition, and reception functio ...
s to retrieve
email
Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" meant ...
messages from a
mail server
Within the Internet email system, a message transfer agent (MTA), or mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using SMTP. The terms mail server, mail exchanger, and MX host ...
over a
TCP/IP
The Internet protocol suite, commonly known as TCP/IP, is a framework for organizing the set of communication protocols used in the Internet and similar computer networks according to functional criteria. The foundational protocols in the suit ...
connection.
IMAP is defined by .
IMAP was designed with the goal of permitting complete management of an
email box A mailboxISO/IEC 2382:2015 (also electronic mailbox, email box, email mailbox, e-mailbox) is the destination to which electronic mail messages are delivered.
It is the equivalent of a letter box in the postal system.
Definitions
A mailbox is identi ...
by multiple email clients, therefore clients generally leave messages on the server until the user explicitly deletes them. An IMAP server typically listens on
port number
In computer networking, a port is a number assigned to uniquely identify a connection endpoint and to direct data to a specific service. At the software level, within an operating system, a port is a logical construct that identifies a specific ...
143. IMAP over
SSL/TLS
Transport Layer Security (TLS) is a cryptographic protocol designed to provide communications security over a computer network. The protocol is widely used in applications such as email, instant messaging, and voice over IP, but its use in securi ...
(IMAPS) is assigned the port number 993.
Virtually all modern e-mail clients and
servers support IMAP, which along with the earlier
POP3
In computing, the Post Office Protocol (POP) is an application-layer Internet standard protocol used by e-mail clients to retrieve e-mail from a mail server. POP version 3 (POP3) is the version in common use, and along with IMAP the most common p ...
(Post Office Protocol) are the two most prevalent standard protocols for email retrieval.
Many
webmail
Webmail (or web-based email) is an email service that can be accessed using a standard web browser. It contrasts with email service accessible through a specialised email client software. Examples of webmail providers are 1&1 Ionos, AOL Mail, G ...
service providers such as
Gmail
Gmail is a free email service provided by Google. As of 2019, it had 1.5 billion active users worldwide. A user typically accesses Gmail in a web browser or the official mobile app. Google also supports the use of email clients via the POP an ...
and
Outlook.com also provide support for both IMAP and POP3.
Email protocols
The Internet Message Access Protocol is an
application layer
An application layer is an abstraction layer that specifies the shared communications protocols and Interface (computing), interface methods used by Host (network), hosts in a communications network. An ''application layer'' abstraction is speci ...
Internet protocol that allows an
e-mail client
An email client, email reader or, more formally, message user agent (MUA) or mail user agent is a computer program used to access and manage a user's email.
A web application which provides message management, composition, and reception functio ...
to access
email
Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" meant ...
on a remote
mail server
Within the Internet email system, a message transfer agent (MTA), or mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using SMTP. The terms mail server, mail exchanger, and MX host ...
. The current version is defined by . An IMAP server typically listens on
well-known port
This is a list of TCP and UDP port numbers used by protocols for operation of network applications.
The Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) only need one port for duplex, bidirectional traffic. They usually u ...
143, while IMAP over SSL/TLS (IMAPS) uses 993.
Incoming email messages are sent to an email server that stores messages in the recipient's email box. The user retrieves the messages with an email client that uses one of a number of email retrieval protocols. While some clients and servers preferentially use vendor-specific,
proprietary protocol
In telecommunications, a proprietary protocol is a communications protocol owned by a single organization or individual.
Intellectual property rights and enforcement
Ownership by a single organization gives the owner the ability to place restricti ...
s, almost all support POP and IMAP for retrieving email – allowing many free choice between many
e-mail clients such as
Pegasus Mail
Pegasus Mail is a proprietary email client developed by David Harris (who also develops the Mercury Mail Transport System). It was originally released in 1990 for internal and external mail on NetWare networks with MS-DOS and later Apple Macint ...
or
Mozilla Thunderbird
Mozilla Thunderbird is a free and open-source cross-platform email client, personal information manager, news client, RSS and chat client developed by the Mozilla Foundation and operated by subsidiary MZLA Technologies Corporation. The project s ...
to access these servers, and allows the clients to be used with
other servers.
Email clients using IMAP generally leave messages on the server until the user explicitly deletes them. This and other characteristics of IMAP operation allow multiple clients to manage the same mailbox. Most email clients support IMAP in addition to
Post Office Protocol (POP) to retrieve messages. IMAP offers access to the mail storage. Clients may store local copies of the messages, but these are considered to be a temporary cache.
History
IMAP was designed by
Mark Crispin
Mark Reed Crispin (July 19, 1956 in Camden, New Jersey – December 28, 2012 in Poulsbo, Washington) is best known as the father of the Internet Message Access Protocol (IMAP), having invented it in 1985 during his time at the Stanford Knowle ...
in 1986 as a remote access mailbox protocol, in contrast to the widely used POP, a protocol for simply retrieving the contents of a mailbox.
It went through a number of iterations before the current VERSION 4rev1 (IMAP4), as detailed below:
Original IMAP
The original ''Interim Mail Access Protocol'' was implemented as a
Xerox
Xerox Holdings Corporation (; also known simply as Xerox) is an American corporation that sells print and electronic document, digital document products and services in more than 160 countries. Xerox is headquartered in Norwalk, Connecticut (ha ...
Lisp Machine
Lisp machines are general-purpose computers designed to efficiently run Lisp as their main software and programming language, usually via hardware support. They are an example of a high-level language computer architecture, and in a sense, the ...
client and a
TOPS-20
The TOPS-20 operating system by Digital Equipment Corporation (DEC) is a proprietary OS used on some of DEC's 36-bit mainframe computers. The Hardware Reference Manual was described as for "DECsystem-10/DECSYSTEM-20 Processor" (meaning the DEC PDP- ...
server.
No copies of the original interim protocol specification or its software exist. Although some of its commands and responses were similar to IMAP2, the interim protocol lacked command/response tagging and thus its syntax was incompatible with all other versions of IMAP.
IMAP2
The interim protocol was quickly replaced by the ''Interactive Mail Access Protocol'' (IMAP2), defined in (in 1988) and later updated by (in 1990). IMAP2 introduced the command/response tagging and was the first publicly distributed version.
IMAP3
IMAP3 is an extremely rare variant of IMAP.
It was published as in 1991. It was written specifically as a counter proposal to , which itself proposed modifications to IMAP2. IMAP3 was never accepted by the marketplace. The
IESG
The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements and a ...
reclassified RFC1203 "Interactive Mail Access Protocol - Version 3" as a Historic protocol in 1993. The IMAP Working Group used RFC 1176 (IMAP2) rather than RFC 1203 (IMAP3) as its starting point.
IMAP2bis
With the advent of
MIME
Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of email messages to support text in character sets other than ASCII, as well as attachments of audio, video, images, and application programs. Message ...
, IMAP2 was extended to support MIME body structures and add mailbox management functionality (create, delete, rename, message upload) that was absent from IMAP2. This experimental revision was called IMAP2bis; its specification was never published in non-draft form. An internet draft of IMAP2bis was published by the IETF IMAP Working Group in October 1993. This draft was based upon the following earlier specifications: unpublished ''IMAP2bis.TXT'' document, , and (IMAP2). The ''IMAP2bis.TXT'' draft documented the state of extensions to IMAP2 as of December 1992. Early versions of
Pine
A pine is any conifer tree or shrub in the genus ''Pinus'' () of the family Pinaceae. ''Pinus'' is the sole genus in the subfamily Pinoideae. The World Flora Online created by the Royal Botanic Gardens, Kew and Missouri Botanical Garden accep ...
were widely distributed with IMAP2bis support
(Pine 4.00 and later supports IMAP4rev1).
IMAP4
An IMAP Working Group formed in the
IETF
The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements and a ...
in the early 1990s took over responsibility for the IMAP2bis design. The IMAP WG decided to rename IMAP2bis to IMAP4 to avoid confusion.
Advantages over POP
Connected and disconnected modes
When using POP, clients typically connect to the e-mail server briefly, only as long as it takes to download new messages. When using IMAP4, clients often stay connected as long as the user interface is active and download message content on demand. For users with many or large messages, this IMAP4 usage pattern can result in faster response times.
Multiple simultaneous clients
The POP protocol requires the currently connected client to be the only client connected to the mailbox. In contrast, the IMAP protocol specifically allows simultaneous access by multiple clients and provides mechanisms for clients to detect changes made to the mailbox by other, concurrently connected, clients. See for example section 5.2 which specifically cites "simultaneous access to the same mailbox by multiple agents" as an example.
Access to MIME message parts and partial fetch
Usually all Internet e-mail is transmitted in
MIME
Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of email messages to support text in character sets other than ASCII, as well as attachments of audio, video, images, and application programs. Message ...
format, allowing messages to have a
tree structure
A tree structure, tree diagram, or tree model is a way of representing the hierarchical nature of a structure in a graphical form. It is named a "tree structure" because the classic representation resembles a tree, although the chart is gener ...
where the leaf nodes are any of a variety of single part content types and the non-leaf nodes are any of a variety of multipart types. The IMAP4 protocol allows clients to retrieve any of the individual MIME parts separately and also to retrieve portions of either individual parts or the entire message. These mechanisms allow clients to retrieve the text portion of a message without retrieving attached files or to
stream
A stream is a continuous body of water, body of surface water Current (stream), flowing within the stream bed, bed and bank (geography), banks of a channel (geography), channel. Depending on its location or certain characteristics, a stream ...
content as it is being fetched.
Message state information
Through the use of flags defined in the IMAP4 protocol, clients can keep track of message state: for example, whether or not the message has been read, replied to, or deleted. These flags are stored on the server, so different clients accessing the same mailbox at different times can detect state changes made by other clients. POP provides no mechanism for clients to store such state information on the server so if a single user accesses a mailbox with two different POP clients (at different times), state information—such as whether a message has been accessed—cannot be synchronized between the clients. The IMAP4 protocol supports both predefined system flags and client-defined keywords. System flags indicate state information such as whether a message has been read. Keywords, which are not supported by all IMAP servers, allow messages to be given one or more
tags whose meaning is up to the client. IMAP keywords should not be confused with proprietary labels of
web-based e-mail services which are sometimes translated into IMAP folders by the corresponding proprietary servers.
Multiple mailboxes on the server
IMAP4 clients can create, rename, and delete mailboxes (usually presented to the user as folders) on the server, and copy messages between mailboxes. Multiple mailbox support also allows servers to provide access to shared and public folders. The ''IMAP4 Access Control List (ACL) Extension'' () may be used to regulate access rights.
Server-side searches
IMAP4 provides a mechanism for a client to ask the server to search for messages meeting a variety of criteria. This mechanism avoids requiring clients to download every message in the mailbox in order to perform these searches.
Built-in extension mechanism
Reflecting the experience of earlier Internet protocols, IMAP4 defines an explicit mechanism by which it may be extended. Many IMAP4
extension
Extension, extend or extended may refer to:
Mathematics
Logic or set theory
* Axiom of extensionality
* Extensible cardinal
* Extension (model theory)
* Extension (predicate logic), the set of tuples of values that satisfy the predicate
* E ...
s to the base protocol have been proposed and are in common use. IMAP2bis did not have an extension mechanism, and POP now has one defined by .
Server push notifications
IMAP IDLE
In email technology, IDLE is an IMAP feature described iRFC 2177that allows a client to indicate to the server that it is ready to accept real-time
Real-time or real time describes various operations in computing or other processes that must guar ...
provides a way for the mail server to notify connected clients that there were changes to a mailbox, for example because a new mail has arrived. POP provides no comparable feature, and email clients need to periodically connect to the POP server to check for new mail.
Disadvantages
While IMAP remedies many of the shortcomings of POP, this inherently introduces additional complexity. Much of this complexity (e.g., multiple clients accessing the same mailbox at the same time) is compensated for by
server-side
In the client–server model, server-side refers to programs and operations that run on the server. This is in contrast to client-side programs and operations which run on the client.
General concepts
Typically, a server is a computer application ...
workarounds such as
Maildir
The Maildir e-mail format is a common way of storing email messages in which each message is stored in a separate file with a unique name, and each mail folder is a file system directory. The local file system handles file locking as messages are ...
or database backends.
The IMAP specification has been criticised for being insufficiently strict and allowing behaviours that effectively negate its usefulness. For instance, the specification states that each message stored on the server has a "unique id" to allow the clients to identify messages they have already seen between sessions. However, the specification also allows these UIDs to be invalidated with no restrictions, practically defeating their purpose.
Unless the mail storage and searching algorithms on the server are carefully implemented, a client can potentially consume large amounts of server resources when searching massive mailboxes.
IMAP4 clients need to maintain a TCP/IP connection to the IMAP server in order to be notified of the arrival of new mail. Notification of mail arrival is done through
in-band signaling
In telecommunications, in-band signaling is the sending of control information within the same band or channel used for data such as voice or video. This is in contrast to out-of-band signaling which is sent over a different channel, or even ov ...
, which contributes to the complexity of client-side IMAP protocol handling somewhat. A private proposal,
push IMAP, would extend IMAP to implement
push e-mail
Push email is an email system that provides an always-on capability, in which new email is actively transferred ( pushed) as it arrives by the mail delivery agent (MDA) (commonly called mail server) to the mail user agent (MUA), also called the ema ...
by sending the entire message instead of just a notification. However, push IMAP has not been generally accepted and current IETF work has addressed the problem in other ways (see the
Lemonade Profile The Lemonade Profile is a set of protocols and mandatory extensions which provides email access to diverse environments, including mobile handsets and other resource constrained devices. It is the product of an IETF Working Group, and is largely bas ...
for more information).
Unlike some proprietary protocols which combine sending and retrieval operations, sending a message and saving a copy in a server-side folder with a base-level IMAP client requires transmitting the message content twice, once to SMTP for delivery and a second time to IMAP to store in a sent mail folder. This is addressed by a set of extensions defined by the IETF
Lemonade Profile The Lemonade Profile is a set of protocols and mandatory extensions which provides email access to diverse environments, including mobile handsets and other resource constrained devices. It is the product of an IETF Working Group, and is largely bas ...
for mobile devices: URLAUTH () and CATENATE () in IMAP, and BURL () in SMTP-SUBMISSION. In addition to this,
Courier Mail Server
The Courier Mail Server is a mail transfer agent (MTA) server that provides SMTP, IMAP, POP3, SMAP, webmail, and mailing list services with individual components. It is best known for its IMAP server component.
Courier can function as an interme ...
offers a non-standard method of sending using IMAP by copying an outgoing message to a dedicated outbox folder.
Security
To cryptographically protect IMAP connections between the client and server, IMAPS on TCP port 993 can be used, which utilizes SSL/TLS.
As of January 2018, TLS is the recommended mechanism.
Alternatively,
STARTTLS can be used to encrypt the connection when connecting to port 143 after initially communicating over
plaintext
In cryptography, plaintext usually means unencrypted information pending input into cryptographic algorithms, usually encryption algorithms. This usually refers to data that is transmitted or stored unencrypted.
Overview
With the advent of comp ...
.
Dialog example
This is an example IMAP connection as taken fro
RFC 3501 section 8
C:
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
NSEEN 17Message 17 is the first unseen message
S: * OK
IDVALIDITY 3857529045UIDs valid
S: a002 OK
EAD-WRITESELECT 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 eader/span>
S: * 12 FETCH (BODY EADER
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
See also
*List of mail server software
This is a list of mail server software: mail transfer agents, mail delivery agents, and other computer software which provide e-mail.
Product statistics
All such figures are necessarily estimates because data about mail server share is difficu ...
*Comparison of email clients
The following tables compare general and technical features of notable email client programs.
General
Basic general information about the clients: creator/company, O/S, licence, & interface. Clients listed on a light purple background are no long ...
* Comparison of mail servers
The comparison of mail servers covers mail transfer agents (MTAs), mail delivery agents, and other computer software that provide e-mail services.
Unix-based mail servers are built using a number of components because a Unix-style environment is ...
* IMAP IDLE
In email technology, IDLE is an IMAP feature described iRFC 2177that allows a client to indicate to the server that it is ready to accept real-time
Real-time or real time describes various operations in computing or other processes that must guar ...
* JSON Meta Application Protocol (JMAP)
* Post Office Protocol
In computing, the Post Office Protocol (POP) is an application-layer Internet standard protocol used by e-mail clients to retrieve e-mail from a mail server. POP version 3 (POP3) is the version in common use, and along with IMAP the most common p ...
(POP)
* Push-IMAP Push-IMAP, which is otherwise known as P-IMAP or ''Push extensions for Internet Message Access Protocol'', is an email protocol designed as a faster way to synchronise a mobile device like a PDA or smartphone to an email server.
It was developed ...
* Simple Mail Access Protocol
* Simple Mail Transfer Protocol
The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typica ...
* Webmail
Webmail (or web-based email) is an email service that can be accessed using a standard web browser. It contrasts with email service accessible through a specialised email client software. Examples of webmail providers are 1&1 Ionos, AOL Mail, G ...
References
Further reading
*
*
*
*
*
External links
*
* — specification of IMAP version 4 revision 1
* — IMAP Implementation Suggestions RFC
* — IMAP4 IDLE command
{{Authority control
Internet mail protocols