Site icon Mailtrap

What is an SMTP Server?

Is it hard to send an email? From a user’s perspective, everything looks quite simple. Under the hood, however, there is a complex system that drives emails from the sender to the recipient. When you click a button to send an email, your email client connects to the mail server. Servers are computers that handle specific services. A mail or email server is meant for dealing with emails. At the same time, we can break down email servers into two categories: outgoing and incoming. Today, we’re talking about a concept related to an outgoing mail server, known as an SMTP server.

What is an SMTP server?

An SMTP server is a computer or an app that is responsible for sending emails. It functions following the Simple Mail Transfer Protocol (SMTP). An SMTP server receives emails from the email client. Then it passes them on to another SMTP server and relays them to the incoming mail server.

What is the difference between an SMTP server and an IMAP/POP3 server?

SMTP is an email sending protocol, whereas IMAP4 and POP3 are protocols to receive emails. Therefore, an incoming mail server may use one of those protocols for email delivery. Here is how they work:

IMAP workflow

POP3 workflow

  • The email client connects to the server 
  • The recipient can see the headers of all emails on the server
  • The email client downloads a chosen email on demand
  • The email client connects to the server
  • The email client retrieves emails 
  • The server deletes the stored emails
  • The email client disconnects from the server

The main difference between these protocols is that IMAP servers always store copies of emails, while POP3 servers delete them once they are retrieved. For more on the Difference Between IMAP, POP3, and SMTP Email Protocols, read our blog post.

How an SMTP server works

Take a look at the basic steps of email sending and what role the SMTP server plays.

What is an SMTP server address?

An SMTP server has a web address to communicate with other servers and clients on the Internet. Usually, it looks like smtp. or mail. plus the domain name. For example, smtp.gmail.com or mail.gmx.net. If you’ve set up a local SMTP server, you can use its IP address, let’s say, 127.0.0.1, instead of the web address. 

Users of shared email services can find information about the SMTP server address by looking up the MX records of the domain.

How an MTA differs from an SMTP server?

It is common practice to use the term “mail transfer agent ” instead of “SMTP server”. But aren’t these notions different? An MTA is software installed on the SMTP server. Generally, an MTA receives emails from an MUA and forwards them to:

In some cases, there could also be a mail submission agent (MSA) between the MUA and MTA. However, many MTAs carry out the MSA function, that’s why the mention of mail submission agents is often omitted. The most used MTAs are Postfix, Sendmail, and Exim.

So, if you name the SMTP server an MTA or even an MSA, this won’t be a mistake. The difference lies in the nomenclature you use.

Is an SMTP server and an SMTP relay the same?

SMTP relay is the process of transferring emails between SMTP servers (or MTAs if you will). Relay happens if the sender and the recipient come from different domains. In practice, however, the term SMTP relay often refers to SMTP servers that enable relaying. Email providers like Mailgun offer such relay servers for bulk email and transactional email sending. In this context, we can say that an SMTP server and an SMTP relay are the same thing.

Should I choose a local or cloud-based SMTP server?

In the article Best Free SMTP Servers, we introduced a list of cloud-based options that most startups and projects opt for. These include Gmail, Amazon SES, Elastic Email, and others. The main benefit of using one of those is that you don’t have to build and maintain the whole email environment. This means you save your resources. If you want to know how to configure Gmail SMTP for sending bulks of emails, check this tutorial.

A local SMTP server might be an option as well. It imposes no limit on how many emails you send per hour/day and ensures control of all your outgoing mail. However, this comes with a drawback as the bounce rate can increase by 20-30%, which is a major consideration for deliverability. If you want to know how to set up a local SMTP server, check out this blog post.

What is a fake SMTP server?

Why would I need a fake one then? – For testing email sending, of course!

At a certain stage of your project, you’ll need to send a couple of test emails from your app or website. You can do this using a real SMTP server. In this case, you would have to tinker around with dummy email addresses unless you want your test emails to hit the inboxes of real customers. But using dummy email for testing just doesn’t work. That’s why a fake SMTP server comes into play!

Mailtrap.io represents a cloud-based email testing service with a fake SMTP server under the hood. You send test emails from your app and Mailtrap catches and puts them into a virtual inbox. You can be sure that none of the emails will get to a real user. Additionally, you can preview the content of the emails, check them for spam and much more. For more on the available features, read the Mailtrap Getting Started Guide.

You may also consider setting up a local fake SMTP server like MailHog or MailCatcher or even a desktop app, for example, FakeSMTP or DevNull SMTP. We described the reasons to choose between cloud-based and local fake SMTP options in the dedicated blog post. 

SMTP relay server or HTTP API – which one is better and when?

A mail user agent (the client) sends emails to the server via SMTP. It is a platform-agnostic protocol widely used for sending emails. At the same time, you can send emails from your app using a web-specific protocol – HTTP. In this case, there are no client-server or server-server back-and-forths. Your app sends HTTP requests to a third-party service that performs email sending. This way of mail delivery is known as HTTP API or Web API.

We can’t claim that Web APIs exceed the service of SMTP relay servers. Each option has its pros and cons:

Web API

SMTP relay server

Pros

  • Fast email delivery
  • Optimized security
  • Analytics capabilities
  • Easy to set up
  • Platform-independent
  • Simpler troubleshooting

Cons

  • Complex solution that requires coding skills
  • Modifiability
  • No unique specification, so each email service provider implements its own solution
  • Slow performance for bulk emails
  • Changing deliverability of emails
  • Possible blockage of port 25

Pick an SMTP server if:

Pick Web API if:

For more about differences between SMTP relay server and HTTP API, read our blog post. 

SMTP server troubleshooting checklist

Let’s say you’ve checked the email sending of your app and it’s alright. We hope that Mailtrap helped you with that :). But when you started using a real SMTP server for sending emails, they were not delivered. The following checklist will help you detect what may be wrong:

To wrap up

An SMTP server is your digital postman, which either delivers your emails right to the recipients’ mailbox or hands them over to other postmen out of your domain. Keep in mind that SMTP servers deal with outgoing mail only. For incoming emails, you’ll need another type of mail server – IMAP or POP3. We’ll talk about them in one of our next blog posts. Stay tuned with Mailtrap!

Exit mobile version