E-Mail Server
E-Mail Server
=============
The E-mail Environment
E-mail evolved from a variety of proprietary systems
In the 1980s and 1990s, people often had e-mail
addresses on a number of systems
The standard for current e-mail services is to use DNS
with a special Mail Exchange record
The Mail Exchange record contains the IP address of the mail
server for a domain
To allow users to send images, video, audio, and other
binary files via e-mails, the Multipurpose Internet
Mail Extension (MIME) specification was developed
Email Services 2
The E-mail Environment…
Protocols used by Email systems to communicate
include:
For sending mail:
Simple Mail Transfer Protocol (SMTP)
For retrieving email from electronic mailboxes
Post Office Protocol (POP)
Internet Mail Access Protocol (IMAP)
Common e-mail packages (servers) include:
Sendmail, Postfix (Linux)
Microsoft Exchange (Windows)
Email Services 3
Role of DNS in E-mail Systems
A domain name, such as example.org, needs to
be associated with two IP addresses
One IP address can be for a Web site
Another IP address is for e-mail
To associate a domain name, or any other host
name, with the IP address of an e-mail server,
you need a Mail Exchange (MX) record
Email Services 4
E-Mail Providers
Every email provider supplies three fundamental
services:
Send email
Receive email
Store received email at least temporarily
Difference between email providers and their
cost depends on:
Versatility
Security
Extent of services
Email Services 5
E-Mail Services
E-Mail services have three distinct components:
Mail User Agent (MUA) – the mail client the user interacts
with
E.g. Kmail, Alphine, Elm (Windows, Linux)
Mail Transfer Agent (MTA) – handles the process of getting
mail from one site to another
E.g. Sendmail, Postfix (Linux)
Microsoft Exchange (Windows)
Mail Delivery Agent (MDA) – takes the message and gets it
to the appropriate user mailbox, when received at the site
E.g. Procmail, Microsoft Exchange
Email Services 6
E-mail Protocols
The core email protocols include:
SMTP (Simple Mail Transfer Protocol) – used by
MTAs to transfers e-mails from one server to
another
POP (Post Officer Protocol) – used by MDAs to
deliver mail to users
IMAP (Internet Message Access Protocol) – also
used by MDAs to deliver mail to users
MAPI (Messaging Application Programming
Interface) – used with MS Outlook in conjunction
with MS Exchange Server mail server
HTTP – for WebMail accounts
Email Services 7
SMTP – Simple Mail Transfer Protocol
Overview
Introduction to SMTP and Email
Message Breakdown
Sample Messages
Extensions (MIME)
MTA’s and Mailbox Protocols
1st – What is SMTP?
The de facto standard for e-mail
transmissions across the Internet
It is defined in RFC 821
It is a relatively simple, text-based protocol
Not entirely secure thus vulnerable to
SPAM
SMTP
Originated in 1982 (rfc0821, Jon Postel)
Goal: To transfer mail reliably and efficiently
SMTP
SMTP clients and
servers have two
main components
User Agents –
Prepares the
message, encloses it
in an envelope.
(Eudora for example)
Mail Transfer Agent
(MTA) – Transfers the
mail across the
internet
SMTP
SMTP also allows the use of Relays allowing
other MTAs to relay/transmit/communicate the
mail.
What is Mail?
Mail is a text file
Envelope –
sender address
receiver address
other information
Message –
Mail Header – defines
the sender, the
receiver, the subject
of the message, and
some other
information
Mail Body – Contains
the actual information
in the message
How SMTP works
The Essentials
Keyword Arguments
HELO Sender’s Host Domain Name
MAIL FROM: Email Address of sender
RCPT TO: Email of Intended recipient
DATA Body of the message
QUIT
TCP Connection
Establishment
Message Progress
Connection Termination
Professor Richards,
By department decree all students in your “Introduction to
Unix” class are hereby to be granted automatic A’s.
Thank you,
Dr. Art Zenner
.
QUIT
Extensions to SMTP
MIME – Multipurpose Internet Mail Extensions
Transforms non-ASCII data to NVT (Network Virtual Terminal)
ASCII data
Text
Application
Image
Audio
Video
MIME and Base64 Encoding
If the internet is the information
highway, then the path for email is a
narrow tunnel
Only very small vehicles can pass trough
Then how do you send a big truck
through a small ravine?
You have to break it down to smaller
pieces and transport the pieces through
the ravine, and reassemble the truck
MIME and Base64 Encoding
The same happens when you send a file
attachment via email.
This is known as encoding
the binary data (256 bits) is transformed to
ASCII text (128 bits
allowing it to fit through the tunnel
On the recipient's end, the data is
decoded and the original file is rebuilt.
Mail Transfer Agents (MTA)
MTAs do the actual mail transfers
MTAs are not meant to be directly
accessed by users.
The MTA delivers email to the user’s
mailbox
Other MTA’s are:
Postfix, Qmail, MS Exchange, CC:Mail
Lotus Notes, ….etc.
Problems with simple SMTP
The first one relates to message length. Some older
implementations cannot handle messages exceeding
64KB.
Another problem relates to timeouts. If the Client and
server have different timeouts, one of them may give
up while the other is still busy, unexpectedly
terminating the connection.
Infinite mail storms can be triggered. For example, If
host 1 holds mailing list A and host 2 holds mailing list B
and each list contains an entry for the other one, then a
message sent to either list could generate a never
ending amount of email traffic unless somebody checks
for it.
ESMTP (RFC 2821)
To get around the problems with simple
SMTP, extended SMTP has been defined in
RFC 2821.
Clients wanting to use it should send an EHLO
message instead of HELO initially. If this is
rejected, then the server is a regular SMTP
server, and the client should proceed in the
usual way. If the EHLO is accepted, then new
commands and parameters are allowed.
POP vs. IMAP
POP3:
All Messages
Internet
Whole
m essage
IMAP:
Dr.Amer
Friends
…. rs
heade
Internet
Post Office Protocol v3
Simple
Allows the user to obtain a list of their
Emails
Users can retrieve their emails
Users can either delete or keep the email
on their system
Minimizes server resources
Internet Mail Access Protocol v4