You are here

Internet email protocols

28 January, 2015 - 18:05

Many Internet protocols are ASCII -based protocols where the client sends requests as one line of ASCII text terminated by CRLF and the server replies with one of more lines of ASCII text. Using such ASCIImessages has several advantages compared to protocols that rely on binary encoded messages

  • the message exchanged by the client and the server can be easily understood by a developer or network engineer by simply reading the messages
  • it is often easy to write a small prototype that implements a part of the protocol
  • it is possible to test a server manually by using telnet. Telnet is a protocol that allows to obtain a terminal on a remote server. For this, telnet opens a TCP connection with the remote server on port 23. However, most telnet implementations allow the user to specify an alternate port as telnet hosts port. When used with a port number as parameter, telnet opens a TCP connection to the remote host on the specified port, telnet can thus be used to test any server using an ASCII-based protocol on top of TCP. Note that if you need to stop a running telnet session, Ctrl-C will not work as it will be sent by telnet to the remote host over the TCP connection. On many telnet implementation you can type Ctrl-l to freeze the TCP connection and return to the telnet interface.
  1. Assume that Alice sends an email from her alice@yahoo.com account to Bob who uses bob@yahoo.com. Which protocols are involved in the transmission of this email ?
  2. Same question when Alice sends an email to her friend Trudy, trudy@gmail.com.
  3. Before the advent of webmail and feature rich mailers, email was written and read by using command line tools on servers. Using your account on sirius.info.ucl.ac.be use the /bin/mail command line tool to send an email to yourself on this host. This server stores local emails in the /var/mail directory with one file per user. Check with /bin/more the content of your mail file and try to understand which lines have been added by the server in the header of your email.
  4. Use your preferred email tool to send an email message to yourself containing a single line of text. Most email tools have the ability to show the source of the message, use this function to look at the message that you sent and the message that you received. Can you find an explanation for all the lines that have been added to your single line email 1?
  5. The first version of the SMTP protocol was defined in RFC 821. The current standard for SMTP is defined in RFC 5321 Considering only RFC 821 what are the main commands of the SMTP protocol 2?
  6. When using SMTP, how do you recognise a positive reply from a negative one ?
  7. A SMTP server is a daemon process that can fail due to a bug or lack of resources (e.g. memory). Network administrators often install tools 3 that regularly connect to their servers to check that they are operating correctly. A simple solution is to open a TCP connection on port to the SMTP server’s host 4. If the connection is established, this implies that there is a process listening. What is the reply sent by the SMTP server when you type the following command ?

telnet cnp3.info.ucl.ac.be 25


Warning: Do not try this on a random SMTP server. The exercises proposed in this section should only be run on the SMTP server dedicated for these exercises : cnp3.info.ucl.ac.be. If you try them on a production SMTP server, the administrator of this server may become angry.
 
  1. Continue the SMTP session that you started above by sending the greetings command (HELO followed by the fully qualified domain name of your host) and terminate the session by sending the QUIT command.
  2. The minimum SMTP session above allows to verify that the SMTP is running. However, this does not always imply that mail can be delivered. For example, large SMTP servers often use a database to store all the email addresses that they serve. To verify the correct operation of such a server, one possibility is to use the VRFY command. Open a SMTP session on the lab’s SMTP server (cnp3.info.ucl.ac.be) and use this command to verify that your account is active.
  3. Now that you know the basics of opening and closing an SMTP session, you can now send email manually by using the MAIL FROM:, RCPT TO: and DATA commands. Use these commands to manually send an email to INGI2141@cnp3.info.ucl.ac.be . Do not forget to include the From:, To: and Subject: lines in your header.
  4. By using SMTP, is it possible to send an email that contains exactly the following ASCII art ?

.

..

  1. Most email agents allow you to send email in carbon-copy (cc:) and also in blind-carbon-copy (bcc:) toa recipient. How does a SMTP server supports these two types of recipients ?
  2. In the early days, email was read by using tools such as /bin/mail or more advanced text-based mail readers such as pine or elm . Today, emails are stored on dedicated servers and retrieved by using protocols such as POP_ or IMAP. From the user’s viewpoint, can you list the advantages and drawbacks of these two protocols ?
  3. The TCP protocol supports 65536 different ports numbers. Many of these port numbers have been reserved for some applications. The official repository of the reserved port numbers is maintained by the Internet Assigned Numbers Authority (IANA) on this site 5. Using this information, what is the default port number for the POP3 protocol ? Does it run on top of UDP or TCP ?
  4. The Post Office Protocol (POP) is a rather simple protocol described in RFC 1939. POP operates in three phases. The first phase is the authorization phase where the client provides a username and a password. The second phase is the transaction phase where the client can retrieve emails. The last phase is the update phase where the client finalises the transaction. What are the main POP commands and their parameters ? When a POP server returns an answer, how can you easily determine whether the answer is positive or negative ?
  5. On smartphones, users often want to avoid downloading large emails over a slow wireless connection. How could a POP client only download emails that are smaller than 5 KBytes ?
  6. Open a POP session with the lab’s POP server (nostromo.info.ucl.ac.be) by using the username and password that you received. Verify that your username and password are accepted by the server.
  7. The lab’s POP server contains a script that runs every minute and sends two email messages to your account if your email folder is empty. Use POP to retrieve these two emails and provide the secret message to your teaching assistant.