SMTP: what the protocol is, how it works and what an SMTP server is
The protocol that carries your emails from one server to another: how it works, which port to use and how to secure it
SMTP (Simple Mail Transfer Protocol) is the standard protocol for sending emails from a client or application to a mail server and transferring them between servers until they reach their destination.
In short, SMTP handles sending email, not reading it or storing it in the inbox. Protocols such as IMAP or POP3 are used to retrieve and sync received messages.
What is the SMTP protocol?
A protocol is a set of rules that two systems follow to understand each other. The SMTP protocol defines how the sender introduces itself, how the recipients are specified, how the message is transmitted and which codes the server returns at each step.
It was described by Jon Postel in RFC 821, published in 1982. The current version is RFC 5321, from 2008. In between came ESMTP (the extended version), which added features such as authentication, STARTTLS encryption and large messages without changing the basis of the protocol.
Today’s servers use ESMTP by default and only fall back to the basic version if the other end doesn’t support it.
SMTP at a glance
| Question | Short answer |
|---|---|
| What is it used for? | To send and relay emails. |
| Does it receive emails? | Not directly. Email is retrieved with IMAP or POP3. |
| Which port does it use? | Port 25 between servers. Port 587 or 465 for authenticated sending from clients and applications. Some providers also offer port 2525. |
| Does it encrypt messages? | Not on its own. The connection is secured with TLS, via STARTTLS or with implicit TLS. |
| Does it prevent spam? | Not on its own. It needs authentication, sending policies and technologies such as SPF, DKIM and DMARC. |
How does SMTP work?
Sending is a dialogue between a client and one or more servers. This is the usual process:

- Creating the message. The user, an online store, a CRM or an application generates the email.
- Connecting to the outgoing server. The client connects to it using a specific host and SMTP port.
- Authentication and encryption. If the service requires it, the sender identifies itself with its credentials and the connection is secured with TLS.
- Identifying the recipient. The server looks up the MX record of the recipient’s domain and finds the server that receives its email.
- Transferring the message. The email may pass through one or more intermediate servers or relay hosts before reaching the destination server.
- Checks by the receiving server. The receiving server checks the domain authentication, the sender’s reputation and its spam filters.
- Delivery and retrieval. If it accepts the message, the message is placed in the mailbox and the recipient reads it via webmail, IMAP or POP3.
The protocol follows a model of storing and forwarding messages (store and forward). If the destination server is unavailable, the sender keeps the message in a queue and tries again later. The outcome depends on the cause of the failure and the provider’s retry policy.
A simple example of an SMTP send
An online store generates a purchase confirmation and hands it to its authenticated sending service. That service finds the customer’s server and passes it the message; the server accepts or rejects it after running its checks. This is how transactional emails work, such as order confirmations, shipping notifications or password resets.
Main SMTP commands
During the connection, the client and the server exchange commands and response codes. These are the most common:
| Command | What it does |
|---|---|
| EHLO | Starts the communication and indicates that the client supports ESMTP. |
| HELO | Starts a basic session, without ESMTP. |
| STARTTLS | Asks to upgrade the connection to a TLS-encrypted connection. |
| AUTH | Starts client authentication when the server requires it. |
| MAIL FROM | Specifies the sender’s return address in the SMTP envelope. |
| RCPT TO | Specifies one of the message’s recipients. |
| DATA | Starts the transfer of the email’s headers and body. |
| QUIT | Ends the session. |
The envelope data doesn’t always match the From and To fields the recipient sees. It’s worth keeping in mind when investigating bounces, forwards or spoofing attempts.
SMTP ports: 25, 587, 465 and 2525
The right port depends on whether the message travels between servers or is sent from a client or an application.
| Port | Typical use | Security and recommendation |
|---|---|---|
| 25 | Transfer or relay between mail servers. | It is the standard port between servers. Many internet service providers block outgoing traffic on it from clients to curb spam. |
| 587 | Sending (submission) from clients and applications. | It is the standard port for authenticated sending. It usually uses STARTTLS. |
| 465 | Authenticated sending with implicit TLS. | The connection is encrypted from the start. RFC 8314, from 2018, recommends it again. |
| 2525 | An alternative offered by some providers. | It isn’t standard, but it helps when the other ports are blocked. |

Don’t pick a port at random. Check your provider’s connection details and confirm three things: port, encryption method and authentication requirement.
SMTP, IMAP and POP3: the differences
SMTP, IMAP and POP3 are all involved in email, but each has its own role.
| Protocol | Main function | Direction | Typical behavior |
|---|---|---|---|
| SMTP | Send and relay emails. | Outgoing. | Delivers the message to the next server along the route. |
| IMAP | Retrieve and sync email from the server. | Incoming. | Keeps messages on the server and syncs changes across devices. |
| POP3 | Download messages from the server. | Incoming. | Downloads email to the device and can delete the copy on the server. |
The same account uses SMTP to send and IMAP to read and sync received messages.
What is an SMTP server?
An SMTP server is the system that accepts, processes, queues and relays outgoing messages. It can belong to an email provider, a company or a specialized SMTP service.
A professional service adds what the protocol doesn’t handle on its own: user and domain authentication, encryption, queue management, retries and bounces, speed and volume control, reputation monitoring and statistics on deliveries, opens and clicks. When a server acts as an intermediary to forward messages, it’s called an SMTP relay.
Most popular SMTP services
If you need one for your website, store or application, these are some of the most popular options (October 2026):
| Service | Best for | Does it have a free plan? |
|---|---|---|
| Mailrelay | Email marketing and transactional email (SMTP and API) in the same account, with EU-based servers and customer support | 30-day trial on the free account. Included in the Standard and Enterprise plans |
| Brevo | Multichannel platform: email, SMS and WhatsApp | Yes, 300 emails a day |
| Mailjet | Transactional sending and campaigns | Yes, 6,000 emails a month (200 a day) |
| SendGrid (Twilio) | API for developers and high volumes | No, since 2025 |
| Amazon SES | Pay-as-you-go infrastructure for technical teams | Pay as you go |
| MailerSend | Transactional emails via API and SMTP | Yes, 500 emails a month |
Gmail and Outlook also have an outgoing server, but their daily limits are designed for personal email, not for bulk or transactional sending.
Send your transactional emails via SMTP
Connect your website, store or application to Mailrelay’s SMTP server and track every send with statistics. Try it for 30 days with the free account.
SMTP security: authentication, TLS, SPF, DKIM and DMARC
The original protocol wasn’t designed with the security controls today’s email requires. That’s why modern sending combines several layers.
Authentication
It lets the server check whether the client is allowed to send, usually with a username and password or other credentials. This prevents third parties from using the server as an open relay.
TLS and STARTTLS
TLS encrypts the connection between two points along the route. STARTTLS starts the session unencrypted and then upgrades it to an encrypted connection. Port 465, on the other hand, uses implicit TLS from the start.
SPF
SPF lets you publish which servers are authorized to send on behalf of a domain.
DKIM
DKIM adds a cryptographic signature to the message. The receiving server verifies it with a public key published in the domain’s DNS.
DMARC
DMARC combines the SPF and DKIM results with the alignment of the sender’s visible domain. It also specifies what to do with messages that fail the checks and lets you receive reports.
These measures limit spoofing and improve email deliverability, although reputation, list quality and content also count.
How do you set up an SMTP account?
To connect an email client, a CRM, a website or an application, you need these details from your provider:
- Server or host: the name of the outgoing server.
- Port: usually 587 or 465.
- Encryption: STARTTLS or implicit TLS.
- Authentication: username and password or the credentials you are given.
- Authorized sender: the address or domain you are allowed to send from.
With those details, go to your tool’s outgoing mail settings, enter the host and port, choose the encryption and enable authentication with your credentials. Then set an authorized sender and send a test message. If it fails, check the error log.
If your website is built with WordPress, you’ll find the step-by-step process and the most popular plugins in the guide to setting up SMTP in WordPress.
Most common SMTP codes and errors
Server responses have three digits, and the first one indicates the result. A 2xx means the operation has been completed, and a 3xx means the server needs more information.
A 4xx is a temporary failure and the sender can try again. A 5xx is a permanent failure that requires fixing the address, the configuration or the cause of the rejection.
| Code | Usual meaning | What to check |
|---|---|---|
| 250 | Action accepted. | Nothing. |
| 421 | Service temporarily unavailable. | The server’s availability or limits. |
| 450 / 451 | Mailbox or processing temporarily unavailable. | Retries, server load or temporary policies. |
| 550 | Recipient doesn’t exist or message rejected. | The address, permissions, reputation and the exact text of the response. |
| 552 | Limit exceeded, often for size or storage. | The email size, attachments or mailbox quota. |
| 554 | Transaction rejected. | Anti-spam policies, authentication and sender reputation. |
The text that accompanies the code provides the context. Two servers may use the same code for different reasons.
Mailrelay and SMTP in email marketing and transactional emails
This protocol is a core part of email marketing, but on its own it doesn’t manage audiences, consent, segmentation, templates or reports.
For transactional emails, it lets you connect a store, a website, a CRM or an application without building an API integration. The API is the better choice when you need a deeper integration and structured responses from your application. Many companies combine the two.
Mailrelay lets you send transactional emails via API or SMTP. The server is included in the Standard and Enterprise plans, and you can try it for 30 days with the free account. Tata Motors, for example, sends its emails this way with Mailrelay, with high availability for more than 300 accounts (see the Tata Motors case study).
Every email sent this way is logged in Reports > SMTP emails, with its status, bounces, complaints, rejections and their reasons, opens and clicks. We explain it in SMTP and API with statistics.
Mailrelay’s SMTP server
Included in the Standard and Enterprise plans, with ticket and chat support (plus phone support on Enterprise). The free account gives you a 30-day trial.
Frequently asked questions about SMTP
What does SMTP stand for?
It stands for Simple Mail Transfer Protocol. It is the standard for sending and transferring emails.
Is SMTP used to send or receive emails?
It is used to send and relay emails. IMAP or POP3 are used to read or sync received messages.
What is my email’s SMTP server?
It depends on your provider. Look in its dashboard or documentation for the outgoing mail server, the port, the encryption method and the credentials.
What is the difference between SMTP and an SMTP server?
The former is the protocol, the set of communication rules. The server is the system that applies those rules to accept, process and relay messages.
What is SMTP relay?
It’s the relaying of an email from one server to another. A relay service receives the message from an authorized sender and delivers it to the recipient’s server.
Key takeaways about SMTP
It’s the protocol that makes it possible to send email between clients, applications and servers. It handles sending, not receiving, and needs TLS, authentication and SPF, DKIM and DMARC records to work reliably.
If you’re going to send large volumes or critical messages, a specialized service takes queues, bounces, reputation and statistics off your hands.