Networking - Simple Mail Transfer Protocol
What is SMTP?
SMTP (Simple Mail Transfer Protocol) is a standard protocol used to send emails from one server to another over the internet. It’s the primary protocol responsible for email delivery, especially from an email client (like Outlook or Gmail) to an email server, or between two email servers.
Features of SMTP:
Feature | Description |
---|---|
Full Form | Simple Mail Transfer Protocol |
Port Numbers | Default: 25, Secure: 465 (SSL) or 587 (TLS) |
Protocol Type | Application layer protocol (uses TCP for reliable transmission) |
Direction | Handles sending and forwarding of email (not receiving) |
How SMTP Works:
-
Email Composition:
-
You write an email using an email client (e.g., Gmail, Outlook).
-
-
Email Submission:
-
The client sends the message to the SMTP server using SMTP (usually on port 587).
-
-
Email Routing:
-
The SMTP server checks the recipient's domain (e.g.,
@example.com
) and finds the destination mail server using DNS and MX (Mail Exchange) records.
-
-
Forwarding:
-
The message is transferred to the recipient’s mail server using SMTP.
-
-
Receiving:
-
The recipient retrieves the email using POP3 or IMAP, not SMTP.
-
Basic SMTP Commands:
Command | Purpose |
---|---|
HELO / EHLO |
Greet the server |
MAIL FROM: |
Specify sender’s email address |
RCPT TO: |
Specify recipient’s email address |
DATA |
Begins the message body |
QUIT |
Ends the session |
SMTP vs POP3 vs IMAP:
Protocol | Purpose | Used By |
---|---|---|
SMTP | Send emails | Email clients → servers |
POP3 | Retrieve & delete emails (downloads to one device) | Email clients ← servers |
IMAP | Access and manage email on the server (syncs across devices) | Email clients ← servers |
Advantages of SMTP:
-
Simple and reliable
-
Widely supported across platforms
-
Works well with other email protocols (POP3, IMAP)
Limitations of SMTP:
-
No encryption by default (needs SSL/TLS for security)
-
Can be exploited for spam if not secured properly
-
Does not handle receiving or storing emails
SMTP (Simple Mail Transfer Protocol) is the backbone of email sending on the internet. It defines how messages are sent from clients to servers and from server to server. While SMTP handles the sending, protocols like IMAP and POP3 are used for retrieving email. Together, they power the global email system we use every day.