.: Latest News :. .:News in Pictures:.




Horoscope Recipes

Weekly SectionMarker



Pakistan's Internet Magazine
Herald




Weather
Dawn Classified

Cowasjee Ayaz Mazdak Review Dawn Magazine Young World Images

Previous Story DAWN - the Internet Edition Next Story



Science.com

August 6, 2005



Using SMTP



By Nizar Diamond Ali


Email clients and web browsers are not really necessary when it comes to sending emails. In fact, even without an email client, you can send emails by directly issuing the commands, which an email client sends in the background. This is known as Simple Mail Transfer Protocol (SMTP), which is responsible for handling outgoing mails.

This is why while configuring a mail client, the SMTP server is always specified. Now let’s bypass the email client and learn more about the protocol that is used for sending emails. This is useful not only for understanding how email works, but it can also be handy when you want to send an urgent email but don’t have the time to install a client.

So, let’s get started. Go to Start>Run. Type “Telnet SMTP-Server 25”. Telnet is a terminal emulation program, which can be used to connect to any TCP server by specifying the host name and port number. “SMTP-Server” is your ISP’s SMTP server. “25” indicates port number (SMTP servers by default listen on port 25). Once the connection is established, you will receive a welcome message, possibly with a complete name and version of SMTP implementation.

Architecture

SMTP architecture involves users connected with sender-SMTP, which is connected with a receiver-SMTP. Commands and data are exchanged between: (1) user- and sender-SMTP and; (2) sender- and receiver-SMTP.

Step one

A typical email transaction starts with the mail command, with the syntax, “MAIL FROM:<from-address> <ENTER>”. “From-address” identifies the sender of the email and is also known as “reverse-path” because in case of problems, a notification is sent to this address. The mail command also results in resetting state tables and buffers in anticipation of a new mail transaction. If the mail sender is accepted, the reply “250 OK” appears.

Step two

Specify the recipient’s address with the command RCPT and the syntax: “RCPT TO:<recipient-address> <ENTER>”. The “recipient-address” here is also called “forward-path”. If the recipient is accepted, the mail server responds with “250 OK”. In case of failure, “550 Failure” appears. For multiple recipients, the command can be repeated several times.

Step three

This step involves sending the mail body. This is done through the data command, with the syntax, “DATA {Mail Server Reply} <mail-body> <ENTER>. <ENTER>”.

As soon as the data command is entered, the mail server responds with an intermediate reply, such as “start mail input; end with a”. Note that at this point, the server considers everything typed as the mail body, except a line with only a full-stop character, which indicates the end. In the syntax given above, data is followed by the mail server’s reply, followed by a user-typed email body.

To indicate the end of the email, an empty line with a full-stop is entered. Detecting this end-of-mail mark, the server replies with “250 OK”. At this point, SMTP is ready for processing the transaction with information stored in its reverse-path buffer, forward-path buffer and mail data buffer. As soon as the transaction is complete, these buffers are cleared. Data command fails when the transaction cannot be completed. There are some commands, which are part of the email body — these are termed as memo commands as they contain details like date, subject, to, cc, etc.

Attachments are also sent as “characters”. File to be sent as attachments are encoded with a file name header and an end-of-file marker. This text is converted at the recipient’s end and decoding results in the creation of an attachment file again.

When a receiver SMTP accepts a message, it adds a time-stamp with server identification at the top of the mail data. For every hop a mail stops, this list grows and forms what we call the mail header. At the time of the final delivery, the return-path is set to the original reverse-path, but it can be different than the sender address.

If an email with multiple recipients cannot be delivered to all, the receiver-SMTP must send an “Undeliverable Mail” notification to the sender.

Client use

Email clients send these commands and others like “HELLO” to identify itself, using a domain name (the server replies with something like “Pleased to meet you, I am <domain>”, and the Quit command for session handling).

The writer’s email is nizar.ali @gmail.com



Click to learn more...
Please Visit our Sponsor (Ads open in separate window)

Previous Story Top of Page Next Story

Seprater
Contributions
Privacy Policy
© DAWN Group of Newspapers, 2005