SMTP Explained for Beginners

E
Editorial Team·18 days ago
018012 minutes read
SMTP Explained for Beginners

Quick answer: SMTP (Simple Mail Transfer Protocol) is the standard protocol for sending email. When an email is sent, the email client connects to an SMTP server, which relays the message to the recipient's mail server. SMTP handles outgoing email only — receiving email uses IMAP or POP3. For email client configuration, port 587 with STARTTLS is the recommended SMTP port.


"What Actually Happens When I Click Send?" — How SMTP Works Behind the Scenes

Most email users interact with email through a client — Gmail in a browser, Outlook on a desktop, or a mail app on a phone — without needing to know what happens technically when a message is sent. But for anyone configuring an email client, setting up an application to send email, troubleshooting delivery problems, or simply curious about how email works, understanding SMTP is the starting point. SMTP is the protocol that moves email from sender to recipient — it has been the foundation of email sending since the early 1980s and remains the standard today. This guide explains what SMTP is, how it works, which ports to use, how it relates to IMAP and POP3, and what common SMTP error codes mean. The guide is written for beginners — no prior technical knowledge is assumed. SMTP standards and provider configurations evolve over time; the details here reflect current standards and common configurations as of mid-2026.


SMTP, IMAP, and POP3 — Key Differences

ProtocolPurposeDirectionCommon PortsSMTPSending emailClient → Server → Server587 (submission), 465 (SSL), 25 (relay)IMAPReceiving / syncing emailServer → Client (synced)993 (SSL/TLS), 143 (STARTTLS)POP3Receiving / downloading emailServer → Client (downloaded)995 (SSL/TLS), 110 (plain)SMTP AUTHAuthenticating before sendingClient → ServerSame as SMTP (587 / 465)SMTPSSMTP over implicit SSL/TLSClient → Server465

1. What SMTP Is and How It Works

SMTP (Simple Mail Transfer Protocol) is the protocol that handles the sending and relaying of email messages. When an email is sent from an email client (Gmail, Outlook, Thunderbird, or any other), the client connects to an SMTP server — typically the outgoing mail server provided by the email service — and submits the message. The SMTP server then looks up the recipient's mail server (using DNS MX records) and relays the message to it. The recipient's mail server stores the message until the recipient's email client retrieves it using IMAP or POP3. The SMTP conversation between client and server follows a defined sequence of commands and responses. The client identifies itself (EHLO command), the server responds with its capabilities, the client authenticates (AUTH command), the client specifies the sender (MAIL FROM command) and recipient (RCPT TO command), the client sends the message content (DATA command), and the server acknowledges receipt. Each server response begins with a three-digit status code — codes beginning with 2 indicate success, 4 indicate temporary failure, and 5 indicate permanent failure. This command-response structure has remained essentially unchanged since SMTP was first defined in 1982.

2. SMTP Ports — Which One to Use

Three ports are commonly associated with SMTP, and understanding the difference matters when configuring an email client or application. Port 25 is the original SMTP port, defined in the original RFC. Today, port 25 is primarily used for server-to-server email relay — mail servers use port 25 to deliver messages to each other. Most ISPs block outbound port 25 from residential and business internet connections to prevent spam, so it is generally not usable for email client submission. Port 587 is the recommended port for email client submission (defined in RFC 6409). It uses STARTTLS — the connection starts unencrypted and is then upgraded to TLS encryption. Port 587 requires SMTP authentication. Port 465 was originally assigned for SMTPS (SMTP over SSL) and uses implicit TLS — the connection is encrypted from the start. It is widely supported by major email providers and is a practical alternative to port 587. For configuring an email client or application to send email, port 587 with STARTTLS and SMTP authentication is the current recommended standard. Port 465 with SSL/TLS is also widely supported and acceptable. The SMTP server address (hostname) is provided by the email service — common examples include smtp.gmail.com for Gmail, smtp.office365.com for Microsoft 365, and smtp.mail.yahoo.com for Yahoo Mail.

3. SMTP Authentication and App Passwords

SMTP authentication (SMTP AUTH) requires the email client or application to provide a username and password before the SMTP server accepts messages for sending. This prevents unauthorized use of the server. The username is typically the full email address; the password is the account password. However, for accounts with two-factor authentication (2FA) enabled, the account password alone is not sufficient for SMTP authentication in third-party email clients — an app-specific password is required. Gmail, Yahoo Mail, and iCloud all require app passwords for SMTP authentication when 2FA is enabled. App passwords are generated in the account's security settings and are used in place of the regular account password in the email client's SMTP configuration. For Microsoft 365 organizational accounts, SMTP authentication may be disabled by the organization's administrator as a security measure — modern authentication (OAuth) is preferred. If SMTP AUTH is needed for a Microsoft 365 account (for example, to configure a legacy application or device to send email), the administrator must enable it for the specific mailbox using PowerShell or the Microsoft 365 admin center. Individual users cannot enable SMTP AUTH themselves if it has been disabled at the organizational level.

4. Common SMTP Settings for Major Email Providers

When configuring an email client or application to send email, the SMTP server address, port, and security settings are needed. Common settings for major providers: Gmail uses smtp.gmail.com on port 587 (STARTTLS) or port 465 (SSL/TLS), with SMTP authentication required and an app password needed if 2FA is enabled. Microsoft 365 / Outlook uses smtp.office365.com on port 587 (STARTTLS), with SMTP authentication required (subject to organizational policy). Yahoo Mail uses smtp.mail.yahoo.com on port 587 (STARTTLS) or port 465 (SSL/TLS), with an app password required if 2FA is enabled. iCloud Mail uses smtp.mail.me.com on port 587 (STARTTLS), with an app-specific password required. These settings are subject to change — verifying current settings in the provider's official documentation before configuring is recommended.

5. SMTP Error Codes — What They Mean

⚠️ SMTP error codes follow a consistent pattern — understanding the first digit is the key to diagnosing delivery failures: SMTP responses are three-digit codes where the first digit indicates the category: 2xx codes indicate success (the command was accepted); 4xx codes indicate temporary failure (the command failed now but may succeed if retried — the sending server will typically retry delivery for several days); 5xx codes indicate permanent failure (the command failed and will not succeed on retry — a bounce notification is sent to the sender). Common specific codes: 421 means the receiving server is temporarily unavailable; 535 means authentication failed (wrong username or password, or app password needed); 550 means the recipient address does not exist or the message was rejected by policy; 552 means the message exceeds the server's size limit; 554 means the transaction failed, often because the sender's IP is on a blocklist or the message was identified as spam. When troubleshooting email delivery failures, the full error message accompanying the code typically provides more specific information about the cause.


Step-by-Step: How to Configure SMTP in an Email Client

Step 1: Gather the SMTP Settings for the Email Account

Before configuring SMTP in an email client, gather the required settings from the email provider's documentation: SMTP server address (hostname), port number (587 or 465), security type (STARTTLS for port 587, SSL/TLS for port 465), username (typically the full email address), and password (account password, or app password if 2FA is enabled). For Gmail: smtp.gmail.com, port 587, STARTTLS. For Microsoft 365: smtp.office365.com, port 587, STARTTLS. For Yahoo: smtp.mail.yahoo.com, port 587, STARTTLS.

Step 2: Generate an App Password if 2FA Is Enabled

If the email account has two-factor authentication enabled, generate an app password before configuring the email client. For Gmail: go to myaccount.google.com > Security > 2-Step Verification > App passwords (at the bottom of the page) > select "Mail" and the device > Generate. For Yahoo: go to account.yahoo.com > Security > Generate app password. For iCloud: go to appleid.apple.com > Sign-In and Security > App-Specific Passwords > Generate. Copy the generated app password — it will be used in place of the regular account password in the email client's SMTP configuration.

Step 3: Enter the SMTP Settings in the Email Client

In the email client's account settings, find the outgoing mail server (SMTP) configuration section. Enter the SMTP server address, port, security type, username, and password (or app password). The exact location of these settings varies by client: in Thunderbird, go to Account Settings > Outgoing Server (SMTP); in Apple Mail, go to Mail > Settings > Accounts > select the account > Server Settings; in most mobile mail apps, go to the account settings and look for "Outgoing Mail Server" or "SMTP".

Step 4: Test the SMTP Configuration

After entering the SMTP settings, send a test email to a different email address to confirm the configuration works. If the test email is sent successfully and arrives at the destination, the SMTP configuration is correct. If sending fails, check the error message — a 535 error indicates an authentication problem (wrong password or app password needed); a connection timeout may indicate the wrong port or a firewall blocking the connection; a "relay not permitted" error may indicate the SMTP server requires authentication that was not configured.

Step 5: Troubleshoot If Sending Fails

If sending fails after configuration, work through the common causes systematically: confirm the SMTP server address is correct (no typos); confirm the port and security type match (587/STARTTLS or 465/SSL); confirm the username is the full email address; confirm the password is correct (or that an app password was generated and used if 2FA is enabled); check whether the email provider requires SMTP AUTH to be enabled separately (Microsoft 365 organizational accounts); and check whether a firewall or network is blocking the SMTP port. The email client's error log or the specific error message returned by the server is the most useful diagnostic tool.


Frequently Asked Questions — SMTP Explained

What is SMTP?

SMTP (Simple Mail Transfer Protocol) is the standard protocol for sending email. When an email is sent, the client connects to an SMTP server, which relays the message to the recipient's mail server. SMTP handles outgoing email only — receiving uses IMAP or POP3. It has been the foundation of email sending since 1982 and is defined in RFC 5321.

What SMTP port should I use?

Port 587 with STARTTLS is the recommended port for email client submission. Port 465 with SSL/TLS is also widely supported. Port 25 is used for server- to-server relay and is typically blocked by ISPs for client use. For most email client and application configurations, port 587 or 465 is the correct choice.

What is the difference between SMTP, IMAP, and POP3?

SMTP sends email (client to server, server to server). IMAP receives email and keeps messages synchronized on the server — suitable for multi-device access. POP3 downloads email to the local device and typically removes it from the server — less suitable for multi-device access. A typical email setup uses SMTP for sending and IMAP for receiving.

What is SMTP authentication?

SMTP AUTH requires the client to provide a username and password before the server accepts messages for sending. For accounts with 2FA enabled (Gmail, Yahoo, iCloud), an app-specific password is required instead of the regular account password. Microsoft 365 organizational accounts may have SMTP AUTH disabled by the administrator — IT admin must enable it per mailbox if needed.

What are common SMTP error codes?

4xx codes are temporary failures (server will retry); 5xx codes are permanent failures (bounce sent to sender). Key codes: 535 = authentication failed; 550 = recipient address does not exist or rejected by policy; 552 = message too large; 554 = transaction failed (often spam or IP blocklist). The full error message accompanying the code provides more specific diagnostic information.


Conclusion & My Take

SMTP is the protocol that has powered email sending for over four decades, and understanding its basics — what it does, which ports to use, how authentication works, and what error codes mean — is useful for anyone who configures email clients, builds applications that send email, or troubleshoots delivery problems. For most users, SMTP operates invisibly in the background; it only becomes visible when something goes wrong or when manual configuration is needed. The most common practical issues with SMTP configuration are authentication failures (wrong password, or app password needed for 2FA accounts) and port or security type mismatches. Starting with port 587 and STARTTLS, using the full email address as the username, and generating an app password if 2FA is enabled resolves the majority of configuration issues. For Microsoft 365 organizational accounts, checking with the IT administrator about SMTP AUTH policy is the first step if configuration fails despite correct settings. For developers building applications that send email, using a dedicated transactional email service (such as SendGrid, Postmark, or Amazon SES) rather than configuring SMTP directly to a personal or organizational email account is generally recommended — these services provide better deliverability, monitoring, and scalability for application email sending.


Sources

Share

Related Posts