What is SMTP?
SMTP, the Simple Mail Transfer Protocol, is the internet standard for sending email. Your mail app uses it to hand a new message to your provider, and mail servers use it to pass that message along until it reaches the recipient's provider. The current specification is RFC 5321, published in October 2008; the protocol itself goes back to RFC 821 in August 1982, which is why so much of it still looks like a typed conversation between two machines.
SMTP only moves mail forwards. It does not let you read a mailbox, list folders or mark messages as read. That job belongs to IMAP or the older POP3, which is why every mail client asks you for two servers: an incoming one and an outgoing one. The outgoing one is the SMTP server.
What is an SMTP server?
An SMTP server is a program that accepts mail over SMTP. RFC 5321 calls the side that opens the connection the "SMTP client" and the side that accepts it the "SMTP server", so the same mail server is both: a server while it receives a message, and a client while it delivers that message onwards. Postfix, Exim and Microsoft Exchange are common examples of software that plays both roles.
When a mail app, a WordPress plugin or a contact form asks for "the SMTP server", it means something narrower: your provider's submission server, the one that checks your password and accepts mail from you. It usually has a name like smtp.yourprovider.com or mail.yourdomain.com. You never configure the recipient's servers; your provider finds those itself with a DNS lookup.
SMTP vs IMAP vs POP3
The three protocols are often listed together, but they do opposite jobs. SMTP pushes mail towards the recipient. IMAP and POP3 let the recipient pull it out of their mailbox.
| SMTP | IMAP | POP3 | |
|---|---|---|---|
| Direction | Sends and relays mail | Reads mail from a mailbox | Reads mail from a mailbox |
| Who talks to whom | App to provider, and server to server | Mail app to your own provider | Mail app to your own provider |
| Where mail ends up | Handed on; nothing is stored for you to read | Stays on the server, synced across devices | Downloaded to one device, usually removed from the server |
| Folders and read status | Not applicable | Yes, kept on the server | No |
| Current standard | RFC 5321 | RFC 9051 (IMAP4rev2, 2021) | RFC 1939 (1996) |
So "what is IMAP?" has a short answer: IMAP, the Internet Message Access Protocol, is how a mail app reads and organises mail that stays on the server. RFC 9051 describes it as letting a client access and manipulate messages on a server, including folders and flags. Use IMAP whenever you read mail on more than one device. POP3 still works, but it was designed to download and delete, which is a poor fit for a phone plus a laptop. The port numbers for all three are in our IMAP, POP3 and SMTP port numbers guide, so they are not repeated here.
How an email travels: MUA, MSA, MTA and MDA
RFC 5598, the Internet Mail Architecture, names the pieces a message passes through. Knowing the names helps, because error messages and provider documentation use them.
| Agent | Full name | What it does | Examples |
|---|---|---|---|
| MUA | Message User Agent | The program a person writes and reads mail in | Outlook, Thunderbird, the Gmail app, a script in your web app |
| MSA | Message Submission Agent | Accepts new mail from an authenticated sender and checks it | Your provider's submission server on 587 or 465 |
| MTA | Message Transfer Agent | Relays mail between servers using SMTP on port 25 | Postfix, Exim, a provider's outbound relays |
| MDA | Message Delivery Agent | Puts the message into the recipient's mailbox | Dovecot's delivery agent, a provider's mailbox store |
Here is the journey when asha@example.in writes to ravi@example.com:
- Submission. Asha's mail app (the MUA) connects to her provider's MSA, logs in, and submits the message over SMTP. RFC 6409 reserves port 587 for this, and its section 4.3 says the MSA must, by default, refuse mail from a session that has not authenticated.
- MX lookup. Her provider's MTA takes the recipient domain,
example.com, and asks DNS for its MX records. RFC 5321 section 5.1 requires this lookup; when there are several MX records, the one with the lowest preference number is tried first, and if a domain has no MX record at all, the sender falls back to its A or AAAA record. Our guide to what DNS is explains MX and the other record types. - Relay. The MTA opens a connection to the recipient's mail server on port 25 and transfers the message with SMTP. This hop is server to server and involves no password, which is exactly why port 25 is abused by spammers.
- Checks. The receiving server checks SPF, DKIM and DMARC for the sending domain, looks at the sending IP's reputation and reverse DNS, and runs its spam filters.
- Delivery. The MDA files the message into Ravi's mailbox.
- Reading. Ravi's phone fetches it over IMAP. SMTP's part ended at step 3.
If the receiving server is down or returns a temporary error, the sending MTA keeps the message in a queue and tries again. RFC 5321 says the retry interval should generally be at least 30 minutes and that the give-up time generally needs to be at least 4 to 5 days, which is why a "delayed delivery" warning can arrive hours after you pressed Send.
What an SMTP conversation looks like
SMTP is a text protocol of short commands and three-digit replies. This trimmed example follows the one in RFC 5321, appendix D; C is the sending client and S is the receiving server:
S: 220 foo.com Simple Mail Transfer Service Ready
C: EHLO bar.com
S: 250-foo.com greets bar.com
S: 250 HELP
C: MAIL FROM:<Smith@bar.com>
S: 250 OK
C: RCPT TO:<Jones@foo.com>
S: 250 OK
C: DATA
S: 354 Start mail input; end with <CRLF>.<CRLF>
C: (headers and body of the message)
C: .
S: 250 OK
C: QUIT
S: 221 foo.com Service closing transmission channel
The first digit of each reply tells you most of what you need when reading a bounce. A 2xx reply means success. A 4xx reply is a temporary failure, so the sender will retry. A 5xx reply is permanent: the address does not exist, the message was rejected as spam, or authentication failed, and retrying will not help.
Note that MAIL FROM (the envelope sender, where bounces go) is separate from the From: header the reader sees. Spoofing works by setting that header to someone else's address, which is the problem SPF, DKIM and DMARC exist to solve.
SMTP authentication and encryption
The original protocol had no login at all. Two additions fixed that for submission. SMTP AUTH (RFC 4954) lets the client prove who it is, with a username and password or a token, before sending. TLS encrypts the session so the password and message do not cross the network in clear text: either with STARTTLS on port 587, where the connection starts plain and is upgraded, or with implicit TLS on port 465, where it is encrypted from the first byte. RFC 8314, published in January 2018, prefers implicit TLS for submission, asks for TLS 1.2 or later, and asks providers to deprecate cleartext submission. In practice both 587 and 465 work with every mainstream provider; use whichever your provider lists.
On the server-to-server hop over port 25, encryption is opportunistic: MTAs use STARTTLS when the other side offers it, and there is no user login, because the receiving server only accepts mail addressed to its own domains.
SPF, DKIM and DMARC: why your mail gets accepted
Receiving servers do not trust the From: address on its own. Three DNS-based checks tell them whether a message really came from the domain it claims. All three are TXT records in your domain's DNS.
| Check | What it proves | Example record | Defined in |
|---|---|---|---|
| SPF | Which servers may send mail using your domain as the envelope sender | example.com TXT "v=spf1 include:_spf.mailprovider.example -all" | RFC 7208 |
| DKIM | The message was signed with a key the domain published, and was not altered on the way | s1._domainkey.example.com TXT "v=DKIM1; k=rsa; p=MIIB..." | RFC 6376 |
| DMARC | SPF or DKIM passed for the same domain as the visible From address, and what to do if neither did | _dmarc.example.com TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com" | RFC 7489 |
Your sending service gives you the exact SPF include and DKIM key to publish. Start DMARC at p=none so you receive reports without blocking anything, then move to quarantine or reject once the reports show all your real mail passing. If you send from a server's own IP, the receiving side will also check that the IP has reverse DNS (a PTR record) pointing to a hostname that resolves back to the same IP. Our note on hosts and hostnames covers how those names fit together.
You can see what any domain publishes with dig:
dig example.com MX +short
dig example.com TXT +short
dig _dmarc.example.com TXT +short
dig -x 203.0.113.10 +short
Why outbound port 25 is closed on most VPS
Port 25 needs no login, so any compromised machine that can reach it can send spam claiming to be from anyone. Blocklists then list the IP, and often the range around it, which hurts every other customer nearby. That is why most cloud providers block outbound port 25 on new servers, and why many home broadband and mobile networks do the same. Inbound port 25 is not affected, so a server can still receive mail.
On a Bigdomainhost KVM VPS or dedicated server, outbound port 25 is closed by default. It can be opened on request once the account has a payment history and we have talked through what you plan to run. The questions we ask, and why, are set out in why port 25 is closed by default. You can check from any Linux server whether it is blocked:
# Outbound 25: times out when blocked
nc -vz -w 5 mx.example.com 25
# Submission on 587 with STARTTLS: should connect and show the certificate
openssl s_client -starttls smtp -connect smtp.example.com:587 -crlf -quiet
Replace the hostnames with your recipient's MX host and your provider's submission server. A timeout on 25 with a working 587 is the normal, expected result on a new server.
Sending email from a VPS: what to do instead
Most people who search for "SMTP server" while setting up a VPS do not need to run one. They need an application, a WordPress site or a scheduled job to send password resets, invoices or alerts. The reliable way to do that is:
- Use a transactional email service for application mail. Connect to its SMTP endpoint on port 587 (or 465) with the credentials it issues, or use its HTTP API. It handles IP reputation, bounces and complaints for you.
- Or use your existing mail provider's SMTP for low volumes, such as a contact form that mails you. Use a dedicated mailbox and an app password, not your main login.
- Publish the records they give you: the SPF include, the DKIM key and a DMARC record. Without them, even correctly sent mail tends to land in spam.
- Stop relying on PHP's
mail()or a bare local sendmail. In WordPress, an SMTP plugin pointed at port 587 fixes most "emails not arriving" complaints. Reports sent from cron jobs should go out the same way.
Running your own outbound mail server is possible, but it is a job in itself: warming up a new IP, watching blocklists, handling bounces and abuse reports. Do it only when mail is part of your product. If you just need mailboxes on a website's domain, our Web & cPanel hosting plans include them, and the client settings are in the email section of our docs.
If a server you host with us cannot send mail, message us on WhatsApp at +91 75994 50220 at any time, call during IST working hours, or email support@bigdomainhost.com, and we will help you read the SMTP error. Setting up a fresh server first? Start with our Ubuntu VPS initial setup guide.
This guide was written by the Bigdomainhost team with AI assistance; facts were checked against the linked RFCs on 27 November 2026.
Sources (checked )
- IETF (RFC Editor): RFC 5321: Simple Mail Transfer Protocol
- IETF (RFC Editor): RFC 5598: Internet Mail Architecture
- IETF (RFC Editor): RFC 6409: Message Submission for Mail
- IETF (RFC Editor): RFC 8314: Cleartext Considered Obsolete: Use of TLS for Email Submission and Access
- IETF (RFC Editor): RFC 4954: SMTP Service Extension for Authentication
- IETF (RFC Editor): RFC 9051: Internet Message Access Protocol (IMAP) Version 4rev2
- IETF (RFC Editor): RFC 1939: Post Office Protocol Version 3
- IETF (RFC Editor): RFC 7208: Sender Policy Framework (SPF)
- IETF (RFC Editor): RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
- IETF (RFC Editor): RFC 7489: Domain-based Message Authentication, Reporting, and Conformance (DMARC)