Glossary

What is SMTP?

Short answer

SMTP, the Simple Mail Transfer Protocol, is the internet standard for sending email between servers and from apps to mail servers. A client connects, names the sender and recipients, sends the message, and the server replies with numeric codes: 2xx for success, 4xx for a temporary failure and 5xx for a permanent one. It is defined in RFC 5321 and runs on ports 25, 587 and 465.

Last checked 16 November 2026

SMTP, the Simple Mail Transfer Protocol, is the standard that mail servers use to send and pass email to each other, and that apps use to hand email to a mail server. It is a plain text conversation: the client says who the mail is from and who it is for, sends the message, and the server answers each step with a three-digit code. The current specification is RFC 5321.

How SMTP works

Sending one email takes a short exchange of commands:

  1. Connect to the server on port 25, 587 or 465.
  2. EHLO introduces the client and lists the server’s extensions, such as STARTTLS and AUTH.
  3. STARTTLS and AUTH encrypt the session and log in (for submission ports).
  4. MAIL FROM gives the envelope sender, also called the Return-Path.
  5. RCPT TO names each recipient.
  6. DATA sends the headers and body, ending with a line that holds only a full stop.
  7. QUIT closes the session.

To deliver to another domain, a server looks up the recipient domain’s MX record and opens an SMTP session with that host.

Example session

S: 220 mx.example.com ESMTP
C: EHLO app.acme.com
S: 250-mx.example.com
S: 250 STARTTLS
C: MAIL FROM:<bounces@send.acme.com>
S: 250 OK
C: RCPT TO:<sam@example.com>
S: 250 OK
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: From: Acme <hello@acme.com>
C: To: sam@example.com
C: Subject: Your login code
C:
C: Your code is 481203
C: .
S: 250 Queued as 4Kx2
C: QUIT
S: 221 Bye

Reply codes

RFC 5321 groups replies by their first digit:

Code Meaning What to do
2xx Success Nothing
4xx Temporary failure Retry later
5xx Permanent failure Do not retry unchanged

Servers often add an enhanced status code from RFC 3463, such as 5.1.1 (mailbox does not exist). The SMTP error codes guide lists the common ones.

Ports

Port Use
25 Server-to-server relay
587 Submission with STARTTLS (RFC 6409)
465 Submission over implicit TLS (RFC 8314)

Why it matters for app email

Even when you send through an email API, SMTP is what carries the message the last mile to Gmail or Outlook. Bounce reasons come back as SMTP codes, so knowing the difference between a 4xx and a 5xx tells you whether to retry or to stop sending to that address.

Common mistakes

  • Connecting on port 25 from a cloud host, where it is often blocked.
  • Wrong TLS mode for the port: implicit TLS on 465, STARTTLS on 587.
  • Retrying 5xx errors, which hurts your sender reputation.
  • Opening a new SMTP connection for every email at volume instead of pooling.

How Mailcandor handles it

Mailcandor accepts SMTP at smtp.mailcandor.com on 465 or 587 through its SMTP relay, alongside the HTTPS API.

Questions

What does an SMTP server do?

It accepts email from a client and either delivers it to a local mailbox or relays it to the recipient's mail server, which it finds through the domain's MX records.

What is the difference between SMTP and IMAP?

SMTP sends and transfers mail. IMAP and POP3 are used by mail apps to read mail that is already in a mailbox.

Which SMTP port should I use?

For an app or device sending through a provider, use 587 with STARTTLS or 465 with implicit TLS. Port 25 is for server-to-server traffic.

What does SMTP error 550 mean?

A permanent failure, most often that the mailbox does not exist or the message was refused by policy. Read the enhanced status code and text that follow it for the exact reason.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.