How does SMTP server work?

Work cycle of SMTP

Most of the online activities are possible because the help of protocols which is the special networking-software rules and guidelines that allow your computer to link up to networks everywhere to shop, read the news, send an email and many more. And you might know that email came much, much before the internet, probably in earlier 1965. When you send mail via Internet, it uses a special protocol name SMTP. Today, we are gonna discuss SMTP in our article. Let’s start with the definition.

What is SMTP?

The term which affects every email you've ever sent out in your life is simple mail transfer protocol or SMTP. Without it, your emails would not go anywhere. When you send an email, your e-mail client interacts with the SMTP server to handle the sending. The SMTP server on your host may have conversations with other SMTP servers to deliver the email. SMTP was first defined by RFC 821 in 1982, eventually declared STD 10.

Today, this protocol use in widespread. SMTP is specified for outgoing mail transport and uses TCP/IP networks. SMTP is similar to any other INTERNET protocol like HTTP, FTP etc. with some commands between server and client. The exchange of email using TCP is performed by a message transfer agent or MTA. Example - Sendmail. End users don't deal with the MTA. MTA's are set by the system administrators. The communication between an SMTP client and SMTP server is by human-readable ASCII text.

Now, let’s find out how does SMTP work?

When you compose a message and send it, here's what happens -

  • When you send an email, your computer connects to your email service’s mail server. An email server handles emails is called SMTP.

  • SMTP server can pass on the mail to another SMTP server and relay it to the destination through several hops.

  • When an email is sent, the email client connects to the SMTP server of the sender’s email service.

  • The client transmits the address of the sender that is the address of the recipient and the content of the message.

  • The SMTP server goes to work at locating the whereabouts of the recipient. Using the recipient’s mail ID which locates the domain name.

  • If the recipient’s mail ID had the same domain name as the sender, then the process would be simpler. The SMTP server would have transferred the mail to its local outgoing mail server (POP3 or IMAP).

  • A domain name represents a unique Web address that's an Internet protocol (IP) address. The link between domain names to their IP addresses is stored in the Domain Name Registry. The SMTP server then contacts the DNS Server.

  • The DNS server sends back the address to the SMTP server.

  • Then the SMTP server proceeds to hand over the email to the SMTP server of the recipient’s email service.

  • This recipient’s SMTP server checks and confirms that the mail addressed belongs to it and hands it over to its counterpart - the POP3 server or IMAP server.

  • POP3 servers are receiving emails. The digit - 3 represents the version number of the protocol. POP3 servers have mail accounts (your email IDs). Each mail account is mapped to a username-password combination.

  • Once the message is handed over to the POP3 server, it is kept and stored in the mail account till the recipient logs in and checks the mail.

  • An email client connects to the POP3 server and tells it to allow download of the email.

  • Once downloaded to the local machine, POP3 mailboxes do not retain a copy of the email. Then, you cannot check your emails from another PC which has already been downloaded.

  • To beat this problem, IMAP was introduced. Internet Message Access Protocol version 4 or IMAP4 simply retains a copy of the emails on the server and allows you to access your e-mail from any location with an internet connection.

After the sending is completed, the client can follow any of these actions -

Terminate Session - If the current Simple Mail Transfer Protocol (SMTP) client has no more messages to send, the connection can be closed with a QUIT command, which will be answered with a 221 Service closing transmission channel reply.

Exchange Roles - If the current SMTP client has no more messages to send but is ready to receive any messages from the current SMTP server, it can issue the TURN command. Now the SMTP client and the SMTP server will switch their role of sender/receiver, and the sender or previous receiver can now send messages by issuing a MAIL command.

Send Another Mail - If the SMTP client as the sender has another message to send, it can issue a new MAIL command.

 

The SMTP server understands very simple text commands like HELO, MAIL, RCPT, and DATA. The most common commands are -

HELO - introduce yourself

EHLO - introduce yourself and request extended mode

MAIL FROM - specify the sender

RCPT TO: - specify the recipient

DATA - specify the body of the message (To, From and Subject should be the first three lines.)

RSET - reset

QUIT - quit the session

HELP - get help on commands

VRFY - verify an address

EXPN - expand an address

VERB - verbose

 

We hope that you might appreciate the synergy of technology that makes it all possible when you do email. Thank you!

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!