What is SMTP?
Last updated:
SMTP stands for Simple Mail Transfer Protocol. It's the standard protocol for sending emails. You can think of it as a postal service for your digital messages. When an application sends an email, this protocol moves the email from one mail server to another.
This protocol has been around since 1982, making it one of the oldest internet protocols still actively used today. While email technology has evolved tremendously since then, it remains the foundation of email delivery. Simple Mail Transfer Protocol works together with authentication methods like DKIM, SPF, and DMARC to ensure your emails not only get delivered, but also land safely in the inbox rather than spam.
In addition to our API, Lettermint also offers SMTP relay for sending both transactional emails and broadcast emails. In this article, we'll explain how the protocol works, which ports to use, and why proper configuration matters for delivering your emails.
How SMTP works
The sending process consists of several steps that together handle email delivery. When you send an email, here's what happens:
- Making a connection: Your email client or application connects to a server. This can be your own mail server or a service like Lettermint.
- Authentication: The server verifies you have permission to send emails using a username and password.
- Transferring the email: Your application hands over the email to the server, including sender, recipient, and message content.
- DNS lookup: The server uses DNS to find out which mail server is responsible for receiving emails for the recipient's domain.
- Connecting to receiving server: The server establishes a connection with the recipient's mail server and attempts to deliver the email.
- Delivery or queue: If the receiving server is available, the email gets delivered immediately. Otherwise, the email stays in the queue for another attempt.
This entire process usually takes just a few seconds. When issues occur like greylisting, delivery may take a bit longer.
Who uses this protocol?
Everyone who sends email uses this system. The approach varies depending on the situation.
As an individual
You send emails through your email provider's server. When you send an email from Gmail, Outlook, or Apple Mail, your email client connects behind the scenes with a server (like smtp.gmail.com) to send that email.
As a developer
You have multiple options. Connect directly with a service like Lettermint, or use your hosting provider's server. Many hosting providers offer their own server that lets you send emails from your application.
As a business
Companies often choose an email service like Lettermint to ensure their emails arrive. This provides better control over email delivery than a hosting provider. Some companies also run their own infrastructure for complete control, think of a bank or government institution.
In all cases, the principle stays the same: the protocol moves your email from one server to another. Whether you're sending a personal email or thousands of transactional emails per day from an application.
SMTP ports
The protocol uses different port numbers to connect with a mail server. Each port has a specific purpose and gets used in different situations.
| Port | Purpose | Encryption | When to use? |
|---|---|---|---|
| 25 | Communication between mail servers | Optional | Only for server-to-server traffic. Often blocked by providers. |
| 587 | Send email with authentication | STARTTLS | Recommended for sending from applications and email clients. |
| 465 | SSL connection | SSL/TLS from start | Alternative to port 587 with direct encryption. |
| 2525 | Alternative to port 587 | STARTTLS | Backup when port 587 is blocked. |
| 2587 | Alternative to port 587 | STARTTLS | Backup when port 587 is blocked. |
| 2465 | Alternative to port 465 | SSL/TLS from start | Backup when port 465 is blocked. |
Why not port 25?
Many providers block port 25 to prevent spam. Spammers used to
send massive amounts of email through port 25 without authentication. By
blocking this port, providers make it harder to send spam.
Which port should you use?
Port 587 and 465 are the best choices for sending email. Port 587 uses STARTTLS (connection starts unencrypted then switches over), while port 465 uses SSL/TLS directly from the start. Both are secure, but port 587 is the more modern standard.
At Lettermint, we use both port 587 and 465 for secure and reliable email delivery. Besides these two ports, we offer several additional ports. Read more in our SMTP documentation.
Port 25 is mainly intended for communication between mail servers. You usually can't use this port for sending emails from an application.
Authentication
Authentication verifies that only authorized users can send emails through a mail server. Without this verification, anyone could abuse the server to send spam.
How does authentication work?
When connecting to a server, you need to log in with a username and password before you can send an email. The server verifies your credentials and then grants permission to send emails.
Most servers use one of these authentication methods:
| Method | Description |
|---|---|
| PLAIN | Username and password are sent (encrypted via TLS) |
| LOGIN | Similar to PLAIN, but with a different format |
| CRAM-MD5 | Password is sent encrypted without being visible in plain text |
With Lettermint, we support all the authentication methods above.
Difference between SMTP, POP3, and IMAP
SMTP, POP3, and IMAP are three protocols you often encounter when setting up your email address in email programs. Email providers and internet providers use these protocols together, but they each have a different function.
| Protocol | Function | When used? |
|---|---|---|
| SMTP | Send email | When you send an email to a recipient |
| POP3 | Retrieve and download email | When you want to download emails to your computer or phone |
| IMAP | Synchronize email | When you want to read emails on multiple devices |
Example: you want to send an email from your email program (like Apple Mail, Spark, or Outlook).
- Your email program uses SMTP to send the email to the recipient's mail server
- The recipient uses POP3 or IMAP to retrieve the email from their own mail server
- With POP3, the email gets downloaded and often removed from the server
- With IMAP, the email stays on the server and you can read it from any device
Simple Mail Transfer Protocol is needed to send emails. POP3 and IMAP are only needed for retrieving emails you receive.
At Lettermint, we focus entirely on sending emails. We don't manage mailboxes, which means POP3 and IMAP don't apply when using Lettermint.
Conclusion
Simple Mail Transfer Protocol handles sending emails between servers. To send emails, you need a server, with port 587 and 465 being the most common and secure options.
Authentication prevents unauthorized users from abusing the server. Encryption like STARTTLS or SSL/TLS protects your login credentials and email content during transmission.
At Lettermint, we provide this infrastructure for sending transactional and broadcast emails. Our European servers deliver your emails securely and quickly, without you needing to manage your own mail server.