2.3 – Electronic Mail in the Internet

  • E-mail is an asynchronous communication medium
  • Modern E-mail has many powerful features, including messages with attachments, hyperlinks, HTML-formatted text, and embedded photos.
  • The Internet mail system contain three major components:
    • User agents:
      • Microsoft outlook and apple mail are examples of user agents. The user agents sends the message to the mail server’s outgoing message queue and receives messages.
    • Mail servers:
      • Each recipient has a “mailbox” located in the server.
      • If a server can’t deliver a mail to another server then it holds the message in the message queue and attempts to transfer it later.
        • Often every 30minute for a few days before failing
    • Simple Mail Transfer Protocol (SMTP):
      • The principle application-layer protocol for Internet electronic mail.
      • It uses reliable data transfer service of TCP to transfer the mail
      • It has a client side and a server side

2.3.1 SMTP

  • Defined in RFC 5321
  • SMTP is much older than HTTP
    • It restricts the body of all mail messages to simple 7-bit ASCII.
      • It requires binary multimedia data to be encoded to ASCII before being sent over SMTP; and it requires the corresponding ASCII message to be decoded back to binary after SMTP transport.
  • A simple example of sending mail:
    • Alice invokes her user agent for e-mail, provides Bob’s e-mail address (for example, [email protected]), composes a message, and instructs the user agent to send the message.
    • Alice’s user agent sends the message to her mail server, where it is placed in a message queue.
    • The client side of SMTP, running on Alice’s mail server, sees the message in the message queue. It opens a TCP connection to an SMTP server, running on Bob’s mail server.
    • After some initial SMTP handshaking, the SMTP client sends Alice’s message into the TCP connection.
    • At Bob’s mail server, the server side of SMTP receives the message. Bob’s mail server then places the message in Bob’s mailbox.
    • Bob invokes his user agent to read the message at his convenience.
  • A simple example of how SMTP transfers a message:
    • The client SMTP has TCP establish a connection to port 25 at the server SMTP. If the server is down, the client tries again later.
    • Once this connection is established, the server and client perform some application-layer handshaking.
      • During this SMTP handshaking phase, the SMTP client indicates the e-mail address of the recipient.
    • Once the SMTP client and server have introduced themselves to each other, the client sends the message. SMTP can count on the reliable data transfer service of TCP to get the message to the server without errors.
      • The clients repeats this process over the same TCP connection if it has other messages to send to the server otherwise, it instructs TCP to close the connection.

2.3.2 – comparison with HTTP

  • Both protocols are used to transfer files from one host to another:
    • HTTP transfer files from a web server to a web client
    • SMTP transfer files from one mail server to another mail server.
    • When transferring the files, both persistent HTTP and SMTP use persistent connections
  • HTTP is mainly a pull protocol: someone loads information on a web server and users use HTTP to pull the information from the server at their convenience. In particular, the TCP connection is initiated by the machine that wants to receive the file.
  • SMTP is mainly a push control: The sending mail server pushes the file to the receiving mail server. In particular, the TCP connection is initiated by the machine that wants to send the file.
  • When it comes to transferring files SMTP only accepts 7-bit ASCII while HTTP data doesn’t restrict you.
  • HTTP encapsulates each object into individual messages while SMTP places all of the message’s object into one single message.

2.3.3 – Mail message format

  • The header lines and the body of the messages are separated by a blank line (by CRLF). RFC 5322 specifies the exact format for mail header lines as well as their semantic interpretations.
    • Each header line contains readable text, conists of a keyword followed by a colon followed by a value. Some of them are required while other are optional.
      • Every header must have:
        • From:
        • To:
      • Every header may include:
        • Subject:
        • Other header lines
  • After the message header, a blank line follows; then the message body follows

2.3.4 – Mail Access Protocols

  • Given the recipient executes his user agent on his local PC, it is natural to consider placing a mail server on his local pc as well. With this approach the senders mail server would dialogue directly with the recipient’s PC.
    • The problem with this is that the mail server reside in his/her’s local pc which means it has to be on 24/7 to receive e-mails.
    • That’s why its normal to run a user agent on your local pc, but have the mailbox on an always-on shared mail server.
  • Typically the sender’s user agent does not dialogue directly with the recipient’s mail server. Instead the senders server uses SMTP to relay the e-mail message to the receivers server.
    • This is done because by having the sender first deposit the email into their server means it can repeatedly try to send the message to the receivers server f.ex. every 30min. until the receivers server becomes available.
  • There’s a number of popular mail access protocols that transfer messages from the server to the user agent.
    • Post Office Protocol – version 3 (POP3):
      • Very simple, but limited
      • Begins when the user agent opens a TCP connections to the mail server on port 110.
      • Three phases after opening the connection:
        • Authorization:
          • The user agent sends username and password
        • Transaction:
          • The user agent retrieves messages and can mark messages for deletion, remove deletion marks and obtain ail statistics
          • Commands: list, retr, dele and quit
        • Update:
          • Occurs after the client has issued the quit command, ending the POP3 session and the mail server deletes emails with a deletion mark.
          • Commands: quit
      • The server can either reply with +OK or –ERR to indicate if the command was fine
      • In the download-and-keep mode, the user agent leaves the messages on the mail server after downloading them
      • POP3 does not carry state information across sessions.
    • Internet Mail access Protocol (IMAP):
      • IMAP is a mail access protocol.
      • It has many more features than POP3, but is far more complex.
      • An IMAP server will associate each message with a folder.
        • When a message arrives it gets associated with the INBOX folder
        • The recipient can then move the message into a new, user-created folder, read the message, delete the message and so on.
      • The IMAP protocol provides commands to allow users to create folders and move messages from one folder to another.
      • IMAP provides commands that allow users to search remote folders for messages matching specific criteria.
      • IMAP maintains state information across IMAP sessions.
      • IMAP has commands that permit a user agent to obtain components of messages.
        • F.ex. only download a message header or just one part of the mulipart MIME message,
    • HTTP:
      • Web-based E-mail client.
      • When a recipient wants to access a message in his mailbox the e-mail message is sent from the recipient server to the recipient browser using the HTTP protocol rather than POP3 or IMAP protocol.
      • When a sender wants to send an e-mail message, the e-mail message is sent from her browser to her mail server over HTTP rather than over SMTP. The server will still send and receive message over SMTP though.

results matching ""

    No results matching ""