What is SMTP?
SMTP (Simple Mail Transfer Protocol) is an application layer protocol used for sending emails over the Internet. It enables communication between email clients and mail servers to transfer messages efficiently. SMTP operates using a push mechanism, ensuring that emails are relayed from the sender to the recipient’s mail server.
Key Features of SMTP
- Text-Based Protocol: Uses plain text commands for communication.
- Connection-Oriented: Requires a reliable TCP connection (Port 25, 587, or 465 for SSL/TLS encryption).
- Works in a Store-and-Forward Model: Emails are routed through multiple mail servers before reaching the recipient.
- Supports Authentication: Secure SMTP (SMTP-AUTH) prevents unauthorized email relaying.
- Handles Multiple Recipients: Can send emails to multiple users at once.
How SMTP Works? (Step-by-Step Process)
SMTP operates in three phases:
1. Establishing a Connection
- The sender’s email client (Mail User Agent – MUA) initiates a connection with the SMTP server.
- A three-way handshake (using TCP) establishes the session.
2. Sending the Email
- The client sends SMTP commands such as:
HELO
orEHLO
– Identifies the client to the server.MAIL FROM:
– Specifies the sender’s email address.RCPT TO:
– Defines the recipient’s email address.DATA
– Begins the email content transfer.
- The server responds with status codes to confirm each step.
3. Email Transmission and Delivery
- Once the email is transmitted, the SMTP server forwards it to the recipient’s mail server.
- The recipient’s server stores the email, waiting for the user to retrieve it using POP3 or IMAP.
SMTP Commands and Responses
SMTP Commands:
Command | Description |
---|---|
HELO / EHLO | Identifies the client to the server |
MAIL FROM: | Specifies sender’s email address |
RCPT TO: | Specifies recipient’s email address |
DATA | Begins the message body transfer |
QUIT | Ends the session |
SMTP Response Codes:
Code | Meaning |
---|---|
220 | SMTP server ready |
250 | Request completed successfully |
354 | Start mail input |
421 | Service not available (server busy) |
550 | Email delivery failed |
Ports Used in SMTP
Port | Purpose | Security |
---|---|---|
25 | Default SMTP Port | Unencrypted |
587 | SMTP with STARTTLS | Encrypted |
465 | SMTPS (SMTP over SSL) | Fully Secure |
Advantages of SMTP
✅ Reliable email transmission across networks.
✅ Supports multiple email recipients in a single session.
✅ Can be secured using authentication (SMTP-AUTH) and encryption (SSL/TLS).
Limitations of SMTP
❌ Lacks built-in security (unencrypted emails can be intercepted).
❌ Cannot retrieve emails (POP3/IMAP is required).
❌ Susceptible to spam unless properly configured.
Conclusion
SMTP remains the backbone of email communication, ensuring the smooth exchange of messages between users worldwide. By implementing security measures like SMTP authentication and encryption, organizations can prevent spam, phishing, and email spoofing effectively.