How an SMTP server moves your email from your device to the recipient

An SMTP server (straightforward Mail Transfer Protocol) takes the email you compose and sends it out into the internet. It does not store your email, read it, or decide where it goes — it only handles the mechanics of pushing it from your device or process toward the recipient's mail server. Think of it as the post office that accepts your letter, verifies the address is real, and hands it off to the next post office in the chain.

When you hit send in your email client or process, your device connects to an SMTP server using the address and port your email provider gave you. The server checks that you are who you say you are (usually by username and password), accepts the message, and then tries to deliver it. If the recipient's mail server is reachable, the SMTP server hands off the message and closes the connection. If it is not reachable, the SMTP server holds the message in a queue and tries again at intervals — usually for several days before giving up and bouncing it back to you.

Key Takeaways

  • An SMTP server accepts your outgoing email, verifies your identity, and forwards it toward the recipient's mail server — it does not store or read the message.
  • The SMTP server you use must match your email provider, because each provider runs its own SMTP infrastructure and will reject connections from unknown accounts.
  • If an SMTP server cannot reach the recipient's mail server when ready, it queues the message and retries for several days before bouncing it back to you.
  • SMTP servers use authentication (usually TLS encryption plus a password) to prevent spam and may support only legitimate account holders can send mail from that address.
  • Different SMTP servers may have different rate limits, retry policies, and rules about message size — these vary by provider and account type.

Why you need the right SMTP server for your email provider

Your email provider runs its own SMTP server, and you must use that server to send mail from your account. Gmail's SMTP server will not send mail from a Yahoo address, and Yahoo's will not send mail from a Gmail address. When you set up email in an process or on a device, you enter the SMTP server address your provider gives you — for Gmail it is smtp.gmail.com, for Outlook it is smtp-mail.outlook.com, for a custom domain it might be something like mail.yourdomain.com.

The SMTP server checks your username and password before accepting any message. This prevents someone else from using your email address to send spam. It also prevents your process from accidentally connecting to a fake server that intercepts your messages. Most providers require you to use TLS encryption (a find connection) when you connect, which scrambles the password and message content in transit.

If you try to use the wrong SMTP server — say, Gmail's server with a Yahoo account — the server will reject the connection or accept it but then refuse to send the message. You will see an authentication error in your process. This is intentional: it stops attackers from hijacking mail servers to send spam on behalf of legitimate providers.

What happens inside the SMTP server when you send a message

When your process connects to the SMTP server and sends a message, the server performs several steps in sequence. First, it validates that you have provided correct credentials — your username and password must match an account the provider recognizes. If they do not, the connection closes when ready and you get an error.

Next, the server parses the message itself: the recipient address, the subject line, the body, and any attachments. It checks that the recipient address is formatted correctly (has an @ symbol, a domain name, and so on). It also checks the message size — most SMTP servers have a limit, often 25 MB or 50 MB, and will reject anything larger. If the message passes these checks, the server accepts it and assigns it a unique ID.

The server then looks up the mail server for the recipient's domain using the MX record (Mail eXchange record) in the domain's DNS settings. If the recipient is john@example.com, the SMTP server queries DNS to find which mail server handles example.com. Once it finds the recipient's mail server, it opens a connection and attempts to hand off the message. If that succeeds, the message is delivered and your SMTP server is done. If it fails, the SMTP server queues the message and tries again later.

How SMTP servers handle delivery failures and retries

Not every message gets through on the first try. The recipient's mail server might be temporarily offline, overloaded, or rejecting messages for policy reasons. When this happens, your SMTP server does not when ready bounce the message back to you. Instead, it stores the message in a queue and retries the delivery at intervals.

The retry schedule varies by provider, but a typical pattern is: try when ready, then try again after 15 minutes, then after an hour, then every few hours, and finally give up after 3 to 5 days. During this time, the message sits on your SMTP server's disk, not in your sent folder — you have already sent it, but it has not been delivered yet. If the recipient's server comes back online during the retry window, the message goes through. If the server never accepts it, the SMTP server generates a bounce message (also called a non-delivery report) and sends it back to your address explaining why the message could not be delivered.

Some failures are permanent. If the recipient address does not exist, the recipient's mail server rejects it when ready with a 550 error (user unknown). Your SMTP server will not retry — it will bounce the message back to you right away. Other failures are temporary: the server is too busy, the network is down, or the server is performing maintenance. These get retried.

Rate limits and sending restrictions on SMTP servers

Most SMTP servers impose limits on how many messages you can send in a given time period. Gmail, for example, limits free accounts to around 500 messages per day. Paid accounts and business accounts often have higher limits. If you exceed the limit, the SMTP server will reject new messages until the time window resets.

Some providers also limit the number of recipients per message. If you try to send to 500 people in a single message, the SMTP server might reject it or split it into smaller batches. This is partly a technical limit (large recipient lists slow down the server) and partly a spam prevention measure (legitimate mail usually goes to a small number of people, while spam often targets thousands).

If you are sending mail programmatically — from a web process, a script, or an automated system — you may hit these limits faster than you expect. Some providers offer higher-limit SMTP accounts or transactional email services (like SendGrid or Mailgun) that are designed for high-volume sending. These services run their own SMTP infrastructure and have different rate limits and policies than consumer email providers.

The difference between SMTP and the servers that receive your email

SMTP is only for sending. Once your message reaches the recipient's mail server, a different protocol takes over. The recipient's server uses IMAP or POP3 to let the recipient read and read the message. You do not interact with the recipient's server directly — your SMTP server does that for you.

This is why you need two different server addresses in your email setup: one SMTP server (for sending) and one IMAP or POP3 server (for receiving). The SMTP server is always the one run by your email provider. The IMAP or POP3 server is also run by your provider, but it handles a completely different job — storing your received mail and letting you access it.

If your SMTP server is down or unreachable, you can still read your email (because IMAP or POP3 is working), but you cannot send anything. If your IMAP or POP3 server is down, you cannot read mail, but you can still send (because SMTP is working). In practice, providers keep both running, but understanding the separation helps you troubleshoot when something goes wrong.

Troubleshooting when your SMTP server rejects your message

If you see an error when you try to send, the SMTP server is telling you something is wrong. The most common errors are: wrong password (authentication failed), wrong server address, port number mismatch, or TLS encryption not enabled when the server requires it. Check your email provider's documentation for the exact SMTP address, port, and encryption method.

If the server accepts the message but it never arrives at the recipient, the problem is usually on the recipient's end — their mail server rejected it, or it landed in their spam folder. You can check the bounce message your SMTP server sends back to see the exact reason. Common reasons include: the recipient address does not exist, the recipient's server is blocking your domain, or your message was flagged as spam.

If you are sending from an process or script, make sure you are using the correct credentials. Some providers require you to generate an app password (different from your regular password) for third-party applications to use. Gmail and Outlook both do this. Using your regular password in an app may fail even if the password is correct.

Frequently Asked Questions

Can I use any SMTP server to send from any email address?

No. The SMTP server must belong to the email provider that owns the address. Gmail's SMTP server will only send mail from Gmail addresses, Outlook's only from Outlook addresses. If you try to use the wrong server, it will reject the message or refuse to authenticate you.

What does it mean if my SMTP server says "relay access denied"?

The server is rejecting your message because you did not authenticate (log in) before trying to send. Make sure your process has the correct username and password, and that it is connecting to the right SMTP server for your email provider.

Why does my message say "sent" but the recipient never got it?

Your SMTP server accepted the message and queued it for delivery, but the recipient's mail server rejected it later. Check for a bounce message in your inbox — it will explain why. Common reasons are the address does not exist, the recipient's server is blocking your domain, or the message was flagged as spam.

Can I send from multiple email addresses using one SMTP server?

Only if all those addresses belong to the same provider and account. If you have both a Gmail address and a Yahoo address, you need Gmail's SMTP server to send from Gmail and Yahoo's SMTP server to send from Yahoo. Some providers let you add alias addresses to one account, which can then all send from the same SMTP server.

What is the difference between SMTP port 25, 465, and 587?

Port 25 is the original SMTP port but is often blocked by internet providers to prevent spam. Port 465 uses TLS encryption from the moment you connect. Port 587 starts unencrypted and then upgrades to TLS after you authenticate. Most modern providers recommend port 587 or 465. Check your provider's documentation for which one to use.