Simple Mail Transfer Protocol (SMTP) is an Internet standard for sending emails. The original specifications for SMTP was published under RFC 821 in 1982. Later on, additional specifications were introduced under RFC 5321. SMTP by default uses TCP port 25 but may also use port 587. If SSL is used to secure the SMTP transmission then the default port is 465.
When you send an email, you are actually sending a bunch of commands to the SMTP server. Below are some of the commands that the SMTP server can recognize:
SMTP server replies
Every command will receive a reply from the mail server in the form of a three digit code followed by a description. The code is standard but the description may vary between different mail servers. Below are some of the possible codes & their meanings that a mail server may respond with:
Typical SMTP conversation
When you make a connection to a mail server, a typical conversation will look like below (BOLD indicates the replies from the server):
Read more about the RFC standards: