---
title: "How Email Works and Explained With An Easy SMTP Example | DuoCircle"
description: "Join the thousands of organizations that use DuoCircle Find out how affordable it is for your organization today and be pleasantly surprised.Interested in"
image: "https://www.duocircle.com/images/og-default.png"
canonical: "https://www.duocircle.com/content/smtp-email/smtp-example/"
---

Content 

#  How Email Works and Explained With An Easy SMTP Example 

 Join the thousands of organizations that use DuoCircle Find out how affordable it is for your organization today and be pleasantly surprised.Interested in 

[ Talk to an Expert → ](/contact/) [ See what we make ](/products/) 

## How Email Works and Explained With An Easy SMTP Example

[Fix Your SPF Errors Now](/content/spf-permerror)

If you are running a business and want to take your email marketing to the next level, then _you need to either have your own dedicated SMTP server or subscribe to a third-party SMTP service_. While running your own **SMTP server** is undoubtedly a big investment as you can reap the benefits for a long time, it still takes a lot of time and effort in managing it. However, with commercial third-party SMTP services, you just subscribe to the service and start using it right away.

But the issue with commercial **SMTP providers** is that you don’t have complete control over the server. While _the service provider guarantees the safety and security of your emails_, the server is still shared by more than one business, and hence there are some **hidden risks** involved. Have you ever wondered what happens behind the screen when you get a popup “You’ve Got Email” or when you click the send button?

Before we dive deeper into the topic, we need to understand the basics of [SMTP email](/content/smtp-email) and then will move onto the installation of the SMTP server with an [SMTP server example](/content/smtp-email/smtp-server-example):

![smtp email](https://media.mailhop.org/duocircle/images/2020/04/backup-mail-server.png) 

### What Is An SMTP Server?

SMTP (Simple Mail Transfer Protocol) is a protocol that takes care of sending emails and, by default, uses SMTP port 25\. POP3 or IMAP protocol is used for receiving emails.

### What Happens When You Click The “Send” Button?

A lot happens in the background after you click the send button. Everything happens in just a few seconds, and no one ever bothers to wonder what exactly happens behind the scenes. Let’s try to untie the knot and will try to explain things in a simple manner:

1. Let’s imagine User ABC wants to send an email to another user XYZ.
2. So, ABC composes his email from his address [abc@mailcompany1.com](mailto:abc@mailcompany1.com) to [xyz@mailcompany2.com](mailto:xyz@mailcompany2.com).
3. Once he clicks the send button, the **SMTP email server** springs into action.
4. The first step is that the mail gets transferred from the Mail User Agent (MUA) to the Mail Submission Agent (MSA) using the SMTP protocol on SMTP port 25.
5. Next, the mail gets transferred from the [Mail Submission Agent](https://en.wikipedia.org/wiki/Message%5Fsubmission%5Fagent) (MSA) to the Mail Transfer Agent (MTA).
6. The MTA is the last boundary of the SMTP server, which decodes the email to lookup the DNS from the Mail Exchanger and tries contacting the domain name using the IP address.
7. It seeks to establish a connection with the recipient SMTP server.
8. Once the connection is established, the MTA hands over the email to the Mail Delivery Agent (MDA)
9. Mail is delivered to the local [SMTP server – free](/content/smtp-email/smtp-server-free) or paid and is stored there.
10. The local Mail User Agent (MUA) takes care of transferring the email to the recipient inbox.
11. In the receiving end, either POP3 or IMAP can be used for receiving the emails.
12. With POP3, the email will be completely downloaded to the user’s system and deleted from the mail server.
13. But with IMAP, only a copy is downloaded, and the original is retained in the mail server.
14. There are instances when the mail gets delayed due to various reasons. During that time, _every mail server has a mail queue where the delayed email gets added to the queue_. The Mail User Agent tries contacting the email client to deliver in scheduled intervals.
15. If it succeeds, the mail gets delivered, and if it fails after some attempts, the email is handed over to the sender Mail Transfer Agent and treated as a bounced email and sent back to the user who had sent the mail.
16. There may be various reasons that an email gets bounced, including invalid address, sender reputation, blacklisted IP, etc. The reason for the email bounce will be specified in the bounced email to enable the user to rectify and send the email back.

![what is my smtp server](https://media.mailhop.org/duocircle/images/2020/04/antispam-filtering-service-email-security-1.png)![smtp server free](https://media.mailhop.org/duocircle/images/2020/04/cloud-based-email-security-1.png)

### How To Setup Your SMTP Server?

If you’ve decided to install your own SMTP server, and when it comes to private SMTP servers, there are many **open-source SMTP servers** available. As an SMTP example for this post, we’ll be using a popular mail server, hMailServer. Here is how you can set it up:

**Step 1)** The first step in setting up your own SMTP server is to download hMailServer. You can download it from [here](https://www.hmailserver.com/download)  
**Step 2)** Once it is downloaded, install the software in your system  
**Step 3)** During installation, ensure the following:

1. “Full installation” is selected
2. Server and Administration Components is selected
3. Choose “built-in database engine” when it asks to select a database server type
4. Create a password for hMailServer

**Step 4)** Once the installation is over, it is time for **configuring the SMTP server**  
**Step 5)** Launch the hMailServer and click “Connect” and enter the password you have chosen during installation  
**Step 6)** Click the “Add Domain” button and specify your domain name  
**Step 7)** In the Accounts tab, click add to create a new account by entering your account name and password  
**Step 8)** In the Setting tab, under Protocols à SMTP, click “Delivery of Emails” and specify the local hostname which should be something like “mail.yourdomain.com”  
**Step 9)** Under Remote Host Name, specify the S**MTP Relayer** if you have an SMTP relay address  
**Step 10)** To test your SMTP server is working, open command prompt and type in telnet mail.hmailserver.com 25  
**Step 11)** If it returns, “could not open a connection to host”, then you need to check with your ISP, or else [SMTP port](/content/smtp-email/smtp-port) 25 is open, and you are all set to send your first email address  
**Step 12)** Additionally, you can add your IP ranges, install spam filters, anti-virus and other necessary tools

### Final Words

Setting up your own SMTP server – free has never been as easy as it is today. But to _ensure that your SMTP server maintains a good reputation and doesn’t get blacklisted_, you need to install **spam filters** and monitor it regularly. Hope the above article with an SMTP server example has answered all of your questions about “[what is my SMTP server](/content/smtp-email/what-is-my-smtp-server)?” and how you can easily set your very own SMTP server.

![smtp](https://media.mailhop.org/duocircle/images/2020/04/email-advanced-threats.png) 

##### Join the thousands of organizations that use DuoCircle

---

Find out how affordable it is for your organization today and be pleasantly surprised.

[Outbound SMTP - Sign Up FREE](/email/outbound-smtp)Interested in our Partner Program for MSPs and VARs? Visit Our [MSP Partner Program](/msp-partner-program).

## Ready to talk?

Same-day response from someone technical. We tell you yes or no quickly. If yes, we get to work.

[Talk to an Expert→](/contact/)[See what we make](/products/)

```json
{"@context":"https://schema.org","@type":"Organization","name":"DuoCircle LLC","url":"https://www.duocircle.com","logo":{"@type":"ImageObject","url":"https://www.duocircle.com/images/duocircle-logo.png"},"description":"DuoCircle is a portfolio of specialized email products covering protection, authentication, delivery, and routing. We deliver about 90% of category-leader capability at roughly half the price, backed by experts who own the outcome. Trusted by 50,000+ organizations since 2014.","subOrganization":[{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138898167","name":"DMARC Report","url":"https://dmarcreport.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897474","name":"AutoSPF","url":"https://autospf.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897912","name":"Phish Protection","url":"https://www.phishprotection.com"}],"sameAs":["https://www.linkedin.com/company/duocircle","https://x.com/duocirclellc","https://www.facebook.com/duocirclellc","https://www.g2.com/products/phish-protection-by-duocircle/reviews","https://github.com/duocircle","https://www.crunchbase.com/organization/duocircle-llc"],"contactPoint":{"@type":"ContactPoint","contactType":"customer support","url":"https://support.duocircle.com"},"knowsAbout":["Email Security","Email Authentication","SPF","DKIM","DMARC","Phishing Protection","Spam Filtering","SMTP Relay","Email Deliverability","Email Forwarding"]}
```

```json
{"@context":"https://schema.org","@type":"WebSite","name":"DuoCircle LLC","url":"https://www.duocircle.com","description":"DuoCircle is a portfolio of specialized email products covering protection, authentication, delivery, and routing. We deliver about 90% of category-leader capability at roughly half the price, backed by experts who own the outcome. Trusted by 50,000+ organizations since 2014.","publisher":{"@type":"Organization","name":"DuoCircle LLC","url":"https://www.duocircle.com","logo":{"@type":"ImageObject","url":"https://www.duocircle.com/images/duocircle-logo.png"},"description":"DuoCircle is a portfolio of specialized email products covering protection, authentication, delivery, and routing. We deliver about 90% of category-leader capability at roughly half the price, backed by experts who own the outcome. Trusted by 50,000+ organizations since 2014.","subOrganization":[{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138898167","name":"DMARC Report","url":"https://dmarcreport.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897474","name":"AutoSPF","url":"https://autospf.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897912","name":"Phish Protection","url":"https://www.phishprotection.com"}]}}
```

```json
[{"@context":"https://schema.org","@type":"WebPage","name":"How Email Works and Explained With An Easy SMTP Example","description":"Join the thousands of organizations that use DuoCircle Find out how affordable it is for your organization today and be pleasantly surprised.Interested in ","url":"https://www.duocircle.com/content/smtp-email/smtp-example/","speakable":{"@type":"SpeakableSpecification","cssSelector":[".page-answer",".duo-rich-text p:first-of-type"]},"dateModified":"2023-08-08T14:26:26.000Z","datePublished":"2020-04-30T13:13:01.000Z"},{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"DuoCircle","item":"https://www.duocircle.com/"},{"@type":"ListItem","position":2,"name":"How Email Works and Explained With An Easy SMTP Example","item":"https://www.duocircle.com/content/smtp-email/smtp-example/"}]}]
```
