How to configure SMTP to send transactional emails
- Published : April 17, 2023
- Last Updated : October 16, 2024
- 10.0K Views
- 4 Min Read
SMTP is a protocol that is used to send emails between users. It's widespread usage is attributed to its simplicity and ease of deployment. If you are involved with setting up an email sending service or even working with emails on a daily basis, it helps to know about how SMTP works. This article will focus on explaining the functionality and working behind SMTP and how you can use SMTP to send transactional emails from ZeptoMail.
What is SMTP?
SMTP or the Simple Mail Transfer Protocol, outlines the rules using which emails can be sent between servers. The SMTP model was first introduced during 1982. An explanation of this can be found in RFC821. RFC821 has defined a schematic model outlining the SMTP flow. This is shown below :
According to the structure defined, SMTP works on a client-server model. The client is any device that sends the message and the server relays the message to the destination.The SMTP client establishes a two-way connection with an SMTP server to deliver a message. The server in turn either delivers the message to the destination or acts as an intermediary to transfer it to another server.
The client and server communicate with each other via commands. So, when a connection request is sent from the client, the server will respond with a command acknowledging it. Once the connection is established, the client transfers information about the sender, receiver of the mail and the message with all the headers to the server. The server then replies to this transaction using some commands. Once the message is completely transferred, the client will close the connection. The whole transaction concludes with the email being sent to the recipient.
Mentioned above, is a high level working of how an email is transferred from the sender to the receiver. The SMTP model has various components aiding the email transfer. Let us look at each of them.
SMTP structure :
The process of SMTP involves the following components : email client, server : sender (SMTP client) and a receiver (SMTP server).
Let's see the function of each one of them.
Mail client :
A mail client is a desktop or web application that sends, receives, stores and retrieves emails. Popular email clients include Zoho mail, Gmail and Microsoft Outlook. A mail client is also called Mail User Agent (MUA).
Mail server :
Mail servers send and receive emails. There are two types of mail servers :
Mail Transfer Agents(MTA) and Mail Delivery agents(MDA).
MTA :
The Mail Transfer Agent or the incoming server, obtains the email from the email clients and sends them to the MDAs. This is done using SMTP, which outlines how the message has to be relayed.
MDA :
The Mail Delivery Agent is the final point before the emails are sent to the recipient server. MDA delivers the email to the recipient's server, from where the message will be retrieved and viewed.
All of these components work in tandem to deliver the email.
How does SMTP work?
As mentioned earlier, SMTP involves the process of back and forth communication between servers to transfer the emails. To understand the working of SMTP, let us take an example of George trying to send an email to Mary:
- George uses a Zoho account. He drafts his email in the Mail user agent (Zoho mail) and clicks send. The message is taken to the Mail Transfer Agent (Zoho's server) where it verifies the identity of the sender, in this case, George's, and forwards the email further. The transfer occurs through the guidelines mentioned in SMTP.
- Next, the email should be sent to the mail server corresponding to Mary's Mail user agent.
- The Mail Transfer Agent then transfers the email to the Mail Delivery Agent, from where the email be transferred to Mary's receiving server.
- Sometimes, the mail will be routed via multiple servers before it reaches the intended one. This process is called an SMTP relay. SMTP relay occurs when the email is transferred between multiple servers. If the domains are different, the MTA will lookup the IP address of the intended server in the DNS records and will transfer the message to them.
- Once the email reaches Mary's email server, it will be checked for its authenticity, i.e., the SPF and DKIM verifications. If the conditions pass, then the message will either be delivered to the mail agent or it will be stored in the server until it is further accessed.
This is a simpler explanation of how SMTP is used while sending your emails. It is alright to use your email client (Zoho mail, etc) for your day-to-day communication. However, if you wish to send transactional emails, it is better to use a professional delivery service, such as ZeptoMail, as other factors like deliverability, sender reputation, and the limit on emails to be sent come into play.
SMTP configuration for ZeptoMail
ZeptoMail is a transactional email sending service for your transactional emails. To send your transactional emails using SMTP, you need to configure the application or website. Follow the steps given below to start sending emails using SMTP in your ZeptoMail account.
- Login to your ZeptoMail account.
- Navigate to the Mail Agent that you wish to send emails from. Go to the setup info tab.
- Copy and paste the following details in the SMTP configuration of your application :
- Server name - smtp.zeptomail.com
- Port Number, Authentication - 465 (SSL), 587 (TLS)
- Username and Password: Refer to the values in your ZeptoMail account.
Sending a test email
To send a test email, follow the steps given below :
- Select the Mail Agent which you have configured in the previous steps.
- Select the Send test email button.
- Fill in the From address, Bounce address, To and Subject.
- Add the custom header parameters if required and click send.