 A Simple E-mail Server
Given that you have an e-mail client on your machine, you are ready to send and receive e-mail. All that you need is an e-mail server for the client to connect to. Let's imagine what the simplest possible e-mail server would look like in order to get a basic understanding of the process. Then we will look at the real thing.
If you have read How Web Servers Work, then you know that machines on the Internet can run software applications that act as servers. There are Web servers, FTP servers, telnet servers and e-mail servers running on millions of machines on the Internet right now. These applications run all the time on the server machine and they listen to specific ports, waiting for people or programs to attach to the port (see How Web Servers Work for details). The simplest possible e-mail server would work something like this:
It would have a list of e-mail accounts, with one account for each person who can receive e-mail on the server. My account name might be mbrain, John Smith's might be jsmith, and so on.
It would have a text file for each account in the list. So the server would have a text file in its directory named MBRAIN.TXT, another named JSMITH.TXT, and so on.
If someone wanted to send me a message, the person would compose a text message ("Marshall, Can we have lunch Monday? John") in an e-mail client, and indicate that the message should go to mbrain. When the person presses the Send button, the e-mail client would connect to the e-mail server and pass to the server the name of the recipient (mbrain), the name of the sender (jsmith) and the body of the message.
The server would format those pieces of information and append them to the bottom of the MBRAIN.TXT file. The entry in the file might look like this: From: jsmith To: mbrain Marshall, Can we have lunch Monday? John There are several other pieces of information that the server might save into the file, like the time and date of receipt and a subject line; but overall, you can see that this is an extremely simple process.
As other people sent mail to mbrain, the server would simply append those messages to the bottom of the file in the order that they arrived. The text file would accumulate a series of five or 10 messages, and eventually I would log in to read them. When I wanted to look at my e-mail, my e-mail client would connect to the server machine. In the simplest possible system, it would:
Ask the server to send a copy of the MBRAIN.TXT file Ask the server to erase and reset the MBRAIN.TXT file Save the MBRAIN.TXT file on my local machine Parse the file into the separate messages (using the word "From:" as the separator) Show me all of the message headers in a list When I double-clicked on a message header, it would find that message in the text file and show me its body.
You have to admit that this is a VERY simple system. Surprisingly, the real e-mail system that you use every day is not much more complicated than this!
The Real E-mail System
For the vast majority of people right now, the real e-mail system consists of two different servers running on a server machine. One is called the SMTP server, where SMTP stands for Simple Mail Transfer Protocol. The SMTP server handles outgoing mail. The other is either a POP3 server or an IMAP server, both of which handle incoming mail. POP stands for Post Office Protocol, and IMAP stands for Internet Mail Access Protocol. A typical e-mail server looks as the picture shown.
The SMTP server listens on well-known port number 25, POP3 listens on port 110 and IMAP uses port 143.

| |
|