1. Technology
Send to a Friend via Email
You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

SMTP Inside Out

How internet email works

By

The toolbar button says

The toolbar button says "Go!" and the email starts its journey. But how?

Heinz Tschabitscher
Have you ever wondered what happens when you press the Send button in your email program? Probably not, I guess — as long as it works. This is exactly the reason why you should wonder, though. In case something doesn't work it's good to know what does not work. Usually, that's half the solution.

When you send email SMTP comes into play. SMTP is short for Simple Mail Transfer Protocol as defined in RFC 2821: Simple Mail Transfer Protocol. Your mail client talks to the SMTP server using this clean and simple procedure to get email from one place to another.

The Flirt

Your email program becomes an SMTP client, connects to port 25 of your mail server (usually the SMTP port) and — says EHLO. Computers, in the end, are only human and what counts is that it wants to be polite. Actually, it does not attempt to be polite but to use later additions to SMTP that have brought about two flavors of the later HELO command (SMTP command generally consist of four characters).

Two Flavors of HELO

EHLO, being the more recent one makes the server advertise all the additional features (such as delivery status notification or the ability to transport messages that contain other than the safe ASCII characters) it supports.

Not every server will allow this greeting, but it is required to accept a plain HELO which naturally assumes that no additional features are present. Both hello commands do require the client to specify its domain after the **LO, however. In practice, this looks something like:

220 mail.domain.net ESMTP Server
HELO
501 HELO requires domain address
HELO localhost
250 mail.domain.net Hello localhost [127.0.0.1], pleased to meet you

(My input is in italics, the servers output is black; lines beginning with a 5 indicate an error.)

The Sender

The remainder of the protocol really deserves the attribute simple. If you want to send an email, you start with the keywords MAIL FROM:. Following this comes the email address of the sender, as suggested by the from. Don't forget to put brackets around the address, though (like <sender@example.com>). Continuing our example, we have:

MAIL FROM: <sender@example.com>
250 sender@example.com... Sender ok

The recipient

After the server has accepted the sender's address, the client can give the address of the recipient. The command for this action, RCPT TO: again is rather suggestive. I want to send mail to myself:

RCPT TO: recipient@example.com
250 support@aboutguide.com... Recipient ok (will queue)

That the server will queue means just that: it will save the mail locally and send it together with all the other queued mail in intervals (for example, every 30 minutes). This behavior depends on the configuration and the server may also deliver the mail instantly.

We're almost done. What's still missing, though, is the important part: the actual message.

Related Video
Create Email Aliases and Forwarding Addresses in Gmail

©2014 About.com. All rights reserved.