Thursday, April 19, 2007

Email Transportion

I learnt about a process which seems to be very complex but very simple in reality. It is a very popular communication tool - EMail.

I will start from email-client side:

When you send an email from your email client say outlook, the whole mail will be converted into text form identifying the domain name of reciept from the email id put in TO address. For example, if swapna@yahoo.com is the recipient email id, domain 'yahoo' is identified and the mail (text form) will be sent to the yahoo domain server.

Now what happens on Server side:

In each server, a text file is maintained for every account i.e. there would be a text file called 'swapna' on yahoo server for swapna@yahoo.com account. When the text form of email is sent to the server from client, it identifies the account name to which it is sent and appends the corresponding text file of the account with the text content recieved. When user opens his account on client, his account's text file will be copied on to client machine and the content of text will be parsed to show list of emails recieved. And the text file on server will be reset.

Let us take a Technical dip:

The real email system consists of two servers running on server machine.
1) One is SMTP - Simple mail transfer protocol which handles outgoing messages.
2) Other is either POP3- Postoffice protocol or IMAP- Internet Mail Access protocol which handles incoming messages.

SMTP:
When you click on send button of email, client connects to SMTP server using port25. It will tell the server sender address, recipient address and body of an email.
Using 'To' address, the SMTP server identifies the domain name. Using DNS, it identifies the IP address of the server and handles the text content to the server.
If the domain of sender's and reciever's is same, then the text content will be dirctly sent to POP3 server of that domain.

POP3:
When you open client to check your emails, client will connect to POP3 server using port 110 of its domain. You need to login credentials to connect to POP3 and once you are connected, client will send series of commands to get email messages to local machine.

IMAP:
IMAP's functionality is similar to POP3. The difference is that it has some advanced benifits than POP3.
When connected to POP3, it copies the text file of the account ot local machine and clears the file on server. Because of that, user cannot check his email messages on different machines. IMAP is a solution for this. It maintains emails on server. So, users can connect on any number of machines.
One more extension in IMAP is that user can organize his emails into folders and maintain all those on server.
What happens when you are not connected to internet? Client maintains a local copy of the emails on local machine. So you are able to view them. When the connection is established, new mails will be shown.

Attachments:
Attachments are also converted to encoded text using a program called uuencode while sending and decoded when it is recieved. This will be done automatically without our intervention.

Thats it...thats enough...

No comments: