The main way email messages are moved around is a protocol called Simple Mail Transfer Protocol (SMTP for short). All this really is, is a conversation between two computers that follows a predictable pattern.

The conversation need the receiving computer to be listening out for the conversation to start, if it is the sending computer will connect to the receiving computer and start the conversation.

If we imagine two computers, fairynet and dragonnet, and two users bob and penny, bob is sending penny a message. But bob is a user of fairynet and penny is a user of dragonnet. If we start when bob has written his message and sent it on fairynet and look at how fairynet sends that message to dragonnet we’ll get the outline of the conversation between the two systems.

First fairynet connects to dragonnet, dragonnet says “Hi I’m dragonnet

fairynet needs to identify itself, and also know how dragonnet handles messages and says “Hi I’m fairynet

dragonnet responds “Here is what I can do” this will also give a list of the commands dragonnet will handle, we’ll cover some of these later.

Now fairynet has to say who it has a message from, so says “I have a message from bob at fairynet

dragonnet is a little terse at this point and just says “OK”

So fairynet now tells dragonnet who the message is from “I have a message for penny at dragonnet

dragonnet remains quite terse, and says “OK”

It’s at this point that fairynet gives the message to dragonnet by basically reading it out to them. If dragonnet is happy it again says “OK”.

The connection remains open so fairynet can send any other messages it has for dragonnet, if there are no more messages fairynet says “goodbye” and the connection is closed.

This conversation is an analogy, each of the messages above have a very specific format, but this shows how the conversation flows in an understandable way.

At each of the steps where dragonnet responds it could, instead of the response we’ve given, respond with an error. These could be temnporary errors, in which case fairynet will keep hold of the message and try again later, or permanant errors, in which case fairynet will give up and tell bob his message couldn’t be delivered. If fairynet holds the message for too long without being able to send it then it will also give up and tell bob his message couldn’t be delivered.