SMTP
SMTP
1. Email Composition:
○ Imagine you're sending an email to your friend. You type the message
in Gmail or Outlook and hit Send.
2. Connection to SMTP Server:
○ The client connects to an SMTP server to send the email.
○ Your email app (like Gmail) talks to an SMTP server (think of it as the
post office for emails).
○ It uses a command like HELO to introduce itself.
3. Mail Transfer Process:
○ The email is sent to the recipient's email server, following the protocol's
rules.
○ The SMTP server takes your email, checks the recipient's address, and
decides where to send it next.
○ If your friend uses a different email provider (e.g., Yahoo), the server
connects to Yahoo's SMTP server to deliver the email.
4. Recipient Access:
○ The recipient retrieves the email via other protocols like IMAP (Internet
Message Access Protocol) and places it in the recipient’s inbox.
○ Once the email reaches Yahoo’s server, it’s stored there until your
friend logs in to check their inbox using IMAP
SMTP Commands:
1. Store-and-Forward Mechanism:
○ SMTP stores emails temporarily on a server if the recipient's server
isn’t available and retries later.
○ Example: If Yahoo’s email server is down, Gmail’s SMTP server will
keep retrying until it’s back online.
2. Relaying Emails:
○ SMTP can relay emails across multiple servers to get them to their
destination.
○ Example: You send an email from Gmail to a friend using Yahoo.
Gmail’s server might pass it through a few servers before it reaches
Yahoo.
3. Error Handling:
○ If there’s a problem, SMTP returns an error message.
○ Example: If you send an email to the wrong address, SMTP will tell
you, "Email address not found."
Limitations of SMTP
1. No Built-In Security:
○ By default, SMTP doesn’t encrypt emails. Anyone intercepting the
message can read it.
○ Example: Sending sensitive information like passwords or bank details
without encryption could expose it to hackers.
○ Enhancement: STARTTLS: Encrypts the communication between the
email client and server.
2. Can’t Handle Attachments or Rich Content:
○ SMTP was originally designed for plain text. To send images, videos, or
formatted text, we need MIME (Multipurpose Internet Mail Extensions).
○ Example: If you attach a picture to an email, MIME converts it so
SMTP can handle it.
3. Server-Specific Issues:
○ Some email servers block Port 25 (default SMTP port) to prevent
spam.
○ Example: If you’re using an older mail setup, you might face trouble
sending emails until you switch to a secure port like 587.
What’s a Port?
● If your email server is set up to use Port 25 but your ISP blocks it, emails won’t be
sent, and you’ll get errors like “Connection Timed Out” or “Unable to Send
Email”.
The Solution:
● Switch to Port 587, which is used for secure email transmission with encryption
(STARTTLS).
● Most modern email systems already default to using Port 587.