RFC 1339 EXPERIMENTAL EMAIL · PROTOCOLS · LIGHTWEIGHT

RMCP: Remote Mail Checking Protocol

Lightweight UDP-based protocol for checking if new mail has arrived.

On rfc-editor.org ↗
PUBLISHED
June 1992
AUTHORS
S. Dorner, P. Resnick
STREAM
Legacy
TRANSPORT PROTOCOL
UDP port 50 (decimal) or port 62 (octal)
MAXIMUM USERNAME LENGTH
512 octets
MINIMUM POLLING INTERVAL
1 poll per minute
RESPONSE FIELDS
3 × 32-bit numbers
DOI
10.17487/RFC1339

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Network Working Group                                         S. Dorner
Request for Comments: 1339                                   P. Resnick
                                     U. of Illinois at Urbana-Champaign
                                                              June 1992


                     Remote Mail Checking Protocol

Status of this Memo

   This memo defines an Experimental Protocol for the Internet
   community.  Discussion and suggestions for improvement are requested.
   Please refer to the current edition of the "IAB Official Protocol
   Standards" for the standardization state and status of this protocol.
   Distribution of this memo is unlimited.

Abstract

   This RFC defines a protocol to provide a mail checking service to be
   used between a client and server pair. Typically, a small program on
   a client workstation would use the protocol to query a server in
   order to find out whether new mail has arrived for a specified user.

Intent

   This RFC defines a simple, low-overhead protocol for checking the
   status of a maildrop on a host. It is primarily intended for use in
   adjunct with "remote mail" servers such as those implementing the
   Post Office Protocol (RFC 1225). Remote mail clients must poll their
   servers to discover the arrival of mail. Using one of the remote mail
   protocols for periodic checking can be quite impractical and
   expensive for the server since either a constant connection between
   client and server must be maintained or repeated and expensive user
   validations must be done. Furthermore, users on less capable
   computers may not wish to devote the memory required to have a full
   implementation of the client polling for mail.  Thus, we feel that an
   easy to implement and inexpensive to use polling scheme would be of
   benefit both to mail servers and their clients.

Protocol Overview

   To avoid connection overhead, the Remote Mail Checking Protocol is
   based on the User Datagram Protocol (UDP), using UDP port 50 decimal
   (62 octal) for the server. The protocol provides for both non-
   authenticated and authenticated polling. Non-authenticated polling is
   simplest for both client and server. Authenticated polling provides a
   small increment of privacy, at the cost of more complexity in both
   client and server (but still far less than polling with one of the
   remote mail protocols).

Non-Authenticated Protocol

   In the non-authenticated version of the protocol, the server will
   listen on port 50 for maildrop check requests for users with
   maildrops on the machine. A client will send a single UDP datagram
   from a randomly chosen unreserved UDP port to UDP port 50 on the
   server. The datagram will contain a 32-bit (four-octet) number which
   is set to all zeros (0), followed by a case-sensitive ASCII string of
   a username on the server system. The server will find the maildrop on
   the system for that user and determine the amount of time that has
   passed since the last message in the maildrop was appended, as well
   as the amount of time that has passed since the maildrop was last
   accessed for reading. The server will then send back a single UDP
   datagram containing three 32-bit numbers in network byte order to the
   originating port on the client. Again, the first will be zero (0),
   the second will contain the number of seconds plus one since the last
   addition to the specified user's maildrop and the third will contain
   the number of seconds plus one since the last read on the user's
   maildrop. If the username provided does not exist, if the maildrop is
   not on the system or if the maildrop is empty, the server will send
   back zero (0) in the last two numbers for its reply. The client will
   consider the maildrop to contain new mail if the number of seconds
   since the last read access is greater than or equal to the number of
   seconds since the last addition access of the maildrop and either
   number is non-zero, old mail if the number of seconds since the last
   read access is less than or equal to the number of seconds since the
   last addition access of the maildrop and either number is non-zero,
   and empty if both numbers are zero.

Authenticated Protocol

   The authenticated protocol operates identically to the non-
   authenticated protocol with the exception of the first interaction
   between the server and the client. After the client has sent its
   initial request containing the requested username, the server will
   send back a single UDP packet containing three 32-bit numbers. The
   first number will be a bit-mask instead of the normal 32-bits of
   zero. The bit-mask will indicate a request for authentication. Each
   bit in the mask represents a type of authentication that the server
   accepts. The bits (with the least significant bit numbered 0, and the
   most significant bit 31) are defined as follows:

      0     Cleartext password The password for the maildrop, not
            NULL-terminated.

      1-23  Reserved for future use

      24-31 Implementation-dependent. Implementors wishing to
            experiment may use these.

   For each type of authentication that the server accepts, the
   corresponding bit will be set to one. All other bits will be set to
   zero.  The last two 32-bit numbers in the reply will be set to zero.
   If the client supports authentication, it will send back a 32-bit
   mask with the bit representing the kind of authentication it is using
   set to one, followed by the data used for authentication. The client
   is free to use any of the types of authentication indicated by the
   authentication request from the server. If the client does not
   support authentication and it receives an authentication request, it
   SHOULD stop sending requests (though this behavior is not required).

   Once a valid authentication is received by the server for a
   particular maildrop, the server considers the IP address and UDP port
   of the client along with that maildrop to be an authenticated
   address/port/maildrop triple. From then on, normal non-authenticated
   transactions take place between the server and the client as
   described above. Should a datagram come from an authenticated
   address/port pair with a different username, or if some amount of
   time has elapsed since the last request (which is implementation
   dependent), the server should remove the address/port/maildrop triple
   from its list of authenticated triples and send another
   authentication request. Since the time required for an authenticated
   triple to become unauthenticated is implementation dependent, clients
   should be prepared to send an authentication reply to containing the
   server whenever it is requested.

Server Implementation Notes

   Servers which implement either the authenticated or non-authenticated
   protocol may decide that they do not wish to reveal the actual amount
   of time that has passed since the last update or read from a
   maildrop. (See the "Security Considerations" section below for
   reasons some feel this is problematic.) In this case, a server may
   instead reply with the following:

                   First 32 bits     Second 32 bits     Third 32 bits
      New mail           0                 0                  1
      Old mail           0                 1                  0
      No mail            0                 0                  0
   These values will appear to the client as correctly representing new,
   old or no mail respectively but will give no indication of the actual
   times that the changes took place.

   Servers implementing the non-authenticated protocol MUST provide some
   mechanism by which users on the system can give permission for their
   maildrops to accessed by the protocol. See the "Security
   Considerations" section below for specifics.

Client Implementation Notes

   Clients MUST not send more than one poll (and one authentication) per
   minute. In particular, lack of server response should not result in
   retransmission.

   Since the last two numbers in an authentication request from a server
   are always 0 as are the last two numbers in a response for an empty
   or non-existent maildrop, clients that do not support authentication
   need not examine the first number in the server datagram at all
   (though they are encouraged to do so for the sake of proper reporting
   to the user).

   Clients can turn the modification interval into absolute time, and
   track the changing of this absolute time in order to discern the
   arrival of new mail (as opposed to the mere existence of unread
   mail). However, such clients should bear three things in mind.
   First, network delays and clock vagaries may result in small
   inconsistencies in times. A "slop factor" of several seconds is
   encouraged. Second, the reading of mail often entails modification of
   the maildrop; the relationship of the access and modification
   intervals should always be consulted. Third, the special results of
   (1,0) and (0,1) are most properly handled as special cases.

   Clients need not recall whether or not they are authenticated (though
   they must use a consistent port if they receive any authentication
   requests for a given maildrop). It is sufficient to issue requests
   when desired, and to respond to any authentication requests that
   appear.

Security Considerations

   The are two security considerations for the protocol. The first is
   one mainly of privacy. Some sites and individual users consider it
   problematic to have information about mail arrival available freely.
   This can be a simple privacy issue for individuals or a security
   issue for highly secure sites. The authenticated version of the
   protocol allows sites to have a reasonable amount of security in that
   only people with passwords can access this information. The protocol
   currently only uses cleartext passwords, but can be simply modified
   to use other authentication formats. The scheme mentioned in "Server
   Implementation Notes" of using only (0,1) and (1,0) in the responses
   also may limit access to some types of information.  Implementations
   that do not use the authenticated scheme MUST have a mechanism by
   which a user can give consent to have this information made
   available; the default for the unauthenticated implementation should
   be that a user's maildrop cannot be accessed until consent of the
   user is given. (For example, UNIX server implementations may wish to
   make use of the "owner execute" bit to indicate whether a particular
   maildrop allows use of the unauthenticated protocol. If this is done,
   a single "stat" call can be used to gather all information required
   to respond to a poll.) Servers which do not implement authentication
   should simply return a zero-filled datagram for maildrops which don't
   have permission.

   The other security consideration involves unknown maildrops and
   usernames. Some site administrators consider it a security risk give
   out any information which would reveal the existence or non-existence
   of a certain username or maildrop on the system. For this reason, we
   have chosen to have the server send back a zero-filled datagram as
   the response to either a request for an unknown username or a
   maildrop that does not exist or is empty. In this way, potential
   security violations are limited, since there is no way to tell the
   difference between an empty maildrop and non-existent maildrop, and
   also no way to tell if the user exists on the system or not. If
   greater security is desired, the protocol should probably not be run
   in the first place.

Authors' Addresses

   Steve Dorner
   Digital Computer Laboratory
   University of Illinois at Urbana-Champaign
   1304 West Springfield Avenue
   Urbana, Illinois 61801

   Phone: (217) 244-1765
   EMail: s-dorner@uiuc.edu

   Pete Resnick
   The Beckman Institute
   University of Illinois at Urbana-Champaign
   405 North Mathews Avenue
   Urbana, Illinois 61801

   Phone: (217) 244-1265
   EMail: resnick@cogsci.uiuc.edu

AI ELI5

On this page
PROBLEMRemote mail servers need clients to poll for new messages, but using full mail protocols (like POP) for frequent polling is expensive in server resources and bandwidth. Clients on limited hardware may not have room for a full mail protocol implementation.
MECHANISMRMCP provides a simple query-response protocol over UDP. A client sends a username, the server replies with the timestamp of the last message added and the last read access. The client compares these to detect new mail. An optional authenticated mode uses a cleartext password.
WHY IT MATTERSClients can poll for mail status using minimal bandwidth and computational overhead, and servers can support many polling clients efficiently without maintaining persistent connections.

§1A Simple Mail Status Check

Remote Mail Checking Protocol solves a practical problem faced by systems using remote mail servers. Clients need to know when new mail arrives, but polling a full mail server like POP repeatedly is resource-intensive for both client and server: connections must be established and authenticated, and the server must maintain state for many polling clients.

RMCP is intentionally minimal. A client sends a single UDP datagram with a username to UDP port 50. The server responds with a single UDP datagram containing three 32-bit numbers that tell the client whether the mailbox is empty, contains old (read) mail, or contains new (unread) mail. The entire exchange uses far less bandwidth and CPU time than a POP connection.

The protocol supports both unauthenticated mode (for open systems) and authenticated mode (for systems that want to control who can check specific mailboxes). An authenticated mode uses cleartext passwords and can be extended with other authentication methods.

The client asks the server one question: any new mail? The server answers with a short number. That is all.

§2How the Protocol Works

RMCP operates entirely over UDP port 50 (decimal) or port 62 (octal). In the unauthenticated mode, the client sends a datagram containing four octets of zeros (a 32-bit zero value) followed by a case-sensitive ASCII username string, null-terminated. The username is limited to 512 octets.

The server responds with a single UDP datagram containing three 32-bit numbers in network byte order. The first is zero. The second number contains the number of seconds plus one since the last message was appended to the user's mailbox. The third contains the number of seconds plus one since the mailbox was last read. If the username does not exist, the mailbox does not exist, or the mailbox is empty, the server sends zeros in the last two fields.

The client determines the mail status by comparing these values: if seconds-since-read is greater than or equal to seconds-since-append and either is non-zero, the mailbox contains new mail. If seconds-since-read is less than or equal to seconds-since-append and either is non-zero, the mailbox contains old mail. If both are zero, the mailbox is empty.

Client sends: 0, username. Server sends: 0, time-since-new-message, time-since-read. Client does simple math to find out the status.

§3Optional Authenticated Access

In authenticated mode, the exchange begins identically to unauthenticated mode. However, the server responds with a 32-bit bitmask in the first field instead of zero. Each bit indicates a type of authentication the server accepts. Currently, only bit 0 is defined: cleartext password authentication. Bits 1 through 23 are reserved for future use, and bits 24 through 31 are available for implementation-specific experiments.

The client chooses one supported authentication type, sends back a datagram with a 32-bit mask (with one bit set indicating which type it chose) followed by the authentication data (a password, in the case of cleartext). The server validates the authentication. Once authenticated, the server associates the client's IP address, UDP port, and username, and subsequent queries from that address and port are treated as authenticated and do not require re-authentication (unless a timeout expires or the client requests a different username).

After successful authentication, the server and client exchange normal unauthenticated-style queries and responses. Authentication is also transparent: if the server does not support a client's requested authentication method, the client should stop polling (though the RFC notes this behavior is not required).

If the server wants to know who is checking, it asks for a password. The client sends a password. Now the server lets that client check without authentication until the session times out.

§4Implementation Considerations and Security

Implementers have flexibility in how they represent mail status. The RFC permits servers to avoid revealing the actual time of the last update or read. Instead of sending real timestamps, servers may send symbolic values: (0, 1) for new mail, (1, 0) for old mail, (0, 0) for no mail. This provides privacy by hiding the exact timing of mail activity.

Clients are required to send no more than one poll per minute per mailbox, and they should not retransmit due to lack of server response (since UDP is unreliable).

For the unauthenticated protocol, servers must provide a mechanism (such as file permissions) by which users can control whether their maildrops can be accessed. Without permission from the mailbox owner, the server should return all zeros. This is important since the protocol can leak information about which users exist on a system.

For the authenticated protocol, cleartext passwords are the current implementation, but the bitmask design allows other authentication methods to be added. The RFC notes that the protocol could be extended to use more secure authentication formats without breaking compatibility with existing clients.

Servers and clients agree on limits: check no more than once per minute, and the server can hide the exact times if it wants to be private. Users control whether their mail status is public.

§5References