Skip to content
Free website migration on every plan, done by our team.Learn more ›
Email

What is SMTP? How email gets from your website to the inbox

What SMTP is, the ports it uses (25, 587, 465), how a message travels from your website to the recipient, and why sending through SMTP improves delivery.

Short answer: SMTP (Simple Mail Transfer Protocol) is how email is sent: from your email app or website to your mail server, and from that server to the recipient's. Apps and websites send on port 587 (or 465) with a username and password; mail servers pass messages to each other on port 25. Reading email uses different protocols, IMAP or POP3. Sending website email through authenticated SMTP, with SPF, DKIM and DMARC in place, is the most reliable way to stay out of spam.

Every email you send makes at least two SMTP hops. Knowing them explains most "my emails aren't arriving" problems.

How an email travels

  1. You (or your website) hand the message to your mail server over SMTP, logging in with a username and password. This is called submission and uses port 587 (with STARTTLS) or 465 (encrypted from the start).
  2. Your mail server looks up the recipient's domain in DNS for its MX records, which name the servers that accept its email.
  3. Your server connects to theirs on port 25 and passes the message over SMTP. The receiving server checks who you are with SPF, DKIM and DMARC and decides: inbox, spam folder or reject.
  4. The recipient reads it with IMAP or POP3 in their app, or through webmail. See IMAP vs POP3.

SMTP ports

PortUsed forEncryption
587Apps and websites sending through their mail serverSTARTTLS (upgrades to encrypted)
465Apps and websites sending through their mail serverTLS from the start
25Mail servers passing email to each otherSTARTTLS when both sides support it

Port 25 is often blocked on home, mobile and many cloud networks to fight spam, so apps should always use 587 or 465.

Why website email goes missing

Many websites send email with PHP's built-in mail() function. That hands the message to the web server with no login, often from an address that doesn't match the domain's records, so receiving servers have little reason to trust it. The fix:

  1. Send through authenticated SMTP, from a real mailbox on your domain (for example noreply@yourdomain.com). On WordPress, an SMTP plugin does this; see WordPress not sending email.
  2. Publish SPF, DKIM and DMARC for your domain so receivers can confirm the email is really yours. Our SPF and DMARC generator writes the records.
  3. Check the result with the email security checker, and make sure your mail server's address isn't on a block list with the blacklist checker.
  4. For large volumes, such as newsletters or shop receipts, use a transactional email service. See newsletter deliverability.

Reading SMTP error messages

When an email bounces, the message includes an SMTP code:

CodeMeaningWhat to do
250AcceptedNothing; it was delivered to the next server
421 / 450 / 451Temporary problem: try laterUsually resolves itself; the sending server retries
535Login failedCheck the SMTP username and password
550Rejected: no such mailbox, or blocked as spamCheck the address; check SPF, DKIM, DMARC and block lists
554Transaction failed, often a policy blockRead the text after the code; it usually names the reason

Codes starting with 4 are temporary; codes starting with 5 are permanent. See why emails go to spam.

Frequently asked questions

What is the difference between SMTP and IMAP?

SMTP sends email. IMAP reads and syncs it from the server to your devices. Your email app uses both: SMTP for outgoing and IMAP for incoming.

Which SMTP port should I use: 587 or 465?

Either works if your mail server supports it. 587 with STARTTLS is the standard submission port; 465 is encrypted from the start and works well where 587 is blocked.

What is an SMTP server?

The mail server that accepts your outgoing email and passes it on. With hosting that includes email, it is usually mail.yourdomain.com, with your mailbox address and password as the login.

Why does my email work in Gmail but not from my website?

Your website is probably sending without logging in. Switch the site to authenticated SMTP through a mailbox on your domain and check your SPF, DKIM and DMARC records.

Ready when you are

Host it where it performs

NVMe speed, offshore privacy and a written SLA — live in minutes on AuroxHost.