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 FlirtYour 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
501 HELO requires domain address
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 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 <firstname.lastname@example.org>). Continuing our example, we have:
MAIL FROM: <email@example.com>
250 firstname.lastname@example.org... Sender ok
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: email@example.com
250 firstname.lastname@example.org... 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.