PrevNEXT

How Email Works

By: Marshall Brain & Tim Crosby

A Simple Email Server

An e-mail server listens to specific ports for incoming messages. Learn about e-mail servers and find out how a simple e-mail server relays messages.
An e-mail server listens to specific ports for incoming messages. Learn about e-mail servers and find out how a simple e-mail server relays messages.
© HowStuffWorks

Given that you have an email client on your machine, you are ready to send and receive email. All that you need is an email server for the client to connect to. Let's imagine what the simplest possible email server would look like in order to get a basic understanding of the process. Then we will look at the real thing.

If you've 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 email 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. The simplest possible email server would work something like this:

Advertisement

  1. It would have a list of email accounts, with one account for each person who can receive email on the server. My account name might be mbrain, John Smith's might be jsmith, and so on.
  2. 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.
  3. If someone wanted to send me a message, the person would compose a text message ("Marshall, Can we have lunch Monday? John") in an email client, and indicate that the message should go to mbrain. When the person presses the Send button, the email client would connect to the email server and pass to the server the name of the recipient (mbrain), the name of the sender (jsmith) and the body of the message.
  4. 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:
  5. 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.

We'll look at the SMTP server in the next section.

Featured