Understanding the SMTP Protocol
When you send an email it travels between many different computers on the way from you to the recipient. The first ‘port of call’ however is the SMTP server, and you must communicate with this server using the SMTP protocol.
What Is SMTP?
SMTP is the acronym for “Simple Mail Transfer Protocol”, which is the standard technology used by people around the globe when sending email. Even though new technologies have been created based off standard SMTP, this simple, text-based protocol continues to be the norm.
The SMTP format became the popular choice during the 1980s, at which time it was a complement to another technology known as UUCP (Unix-to-Unix Copy). While UUCP was an excellent solution for handling email transfers going between intermittently connected computers, SMTP was found to be a much better option for sending and receiving emails on computers connected to a network permanently.
By 2001, approximately 50 different programs used SMTP as a client (which is responsible for sending emails) as well as a server (which receives these emails). Originally, SMTP was an ASCII, text-based solution, which means there were problems with binary files – images for example. Standards such as MIME (Multipurpose Internet Mail Extensions) were developed to allow binary files to be encoded and sent via SMTP.
Sample Communication
Below you’ll find a basic sample of a communication between a sender and an SMTP server. First, a TCP connection from the sender (the client) to the server is made on the appropriate host port. Port number 25 is by far the most common port used with SMTP. This can be achieved on most machines by simply entering the following command at a command prompt (using smtp2go.com as an example server).
telnet smtp2go.com 25
The actual communication is below (
S: stands for server and
C: stands for client).
S: 220 smtp2go.com ESMTP Exim
C: HELO mydomain.com
S: 250 Hello mydomain.com
C: MAIL FROM:<sender@mydomain.com>
S: 250 Ok
C: RCPT TO:<recipient@anotherdomain.com>
S: 250 Accepted
C: DATA
S: 354 Enter message, ending with “.” on a line by itself
C: Subject: sample message
C: From: sender@mydomain.com
C: To: recipient@anotherdomain.com
C:
C: Greetings,
C: Typed message (content)
C: Goodbye.
C: .
S: 250 OK
C: QUIT
S: 221 www.sample.com closing connection
Extended SMTP
Almost all clients (for example Outlook, Eudora Mail) will actually issue the greeting of EHLO behind the scenes, instead of HELO. ELHO invokes what is known as Extended SMTP (ESMTP) and is used to enable more options and to see which extensions are supported by the server. If the server fails to respond to the EHLO command, the client can use HELO (which will always work).
Just one of the features of using ESMTP is that you can determine in advance whether a server will be able to send an email of a certain size. With some outdated clients and servers large messages are actually rejected, but only after spending significant time on the network trying to get the email through.
S: 220 www.sample.com ESMTP Exim
C: EHLO mydomain.com
S: 250 Hello mydomain.com
S: SIZE 10000000
S: PIPELINING
S: HELP
C: MAIL FROM:<sender@mydomain.com>
S: 250 Ok
If a number if printed next to the SIZE keyword by the server, it indicates the absolute maximum allowed size of a message. If no number is printed, additional interaction can be initiated by the user to test to see if their message will be able to be sent.
Further Reading
Formally SMTP is defined in RFC 821 as amended by RFC 1123. The particular protocol used by clients today is also known as ESMTP and is defined in RFC 2821.
The main problem people have with sending emails is that most SMTP servers require that you always connect to the Internet through the ISP that actually provided the server. For mobile users this is impossible in many situations. Return Home to find out about SMTP2Go, an SMTP server you can use in any city or country, anywhere in the world - from your laptop, PDA, home or office.