Electronic Mail Prof. Indranil Sen Gupta Professor, Dept. of - - PowerPoint PPT Presentation

electronic mail
SMART_READER_LITE
LIVE PREVIEW

Electronic Mail Prof. Indranil Sen Gupta Professor, Dept. of - - PowerPoint PPT Presentation

Electronic Mail Prof. Indranil Sen Gupta Professor, Dept. of Computer Science & Engineering Indian Institute of Technology Kharagpur 1 Introduction Most heavily used application on the Internet. Simple Mail Transfer Protocol


slide-1
SLIDE 1

Electronic Mail

1

  • Prof. Indranil Sen Gupta

Professor, Dept. of Computer Science & Engineering Indian Institute of Technology Kharagpur

slide-2
SLIDE 2

Introduction

  • Most heavily used application on the

Internet.

  • Simple Mail Transfer Protocol (SMTP)

– Uses TCP/IP

2

– Uses TCP/IP – Delivery of simple text messages

  • Multi-purpose Internet Mail Extension

(MIME)

– Delivery of other types of data – Voice, images, video clips

slide-3
SLIDE 3

Simple Mail Transfer Protocol (SMTP)

  • Based on RFC 821.
  • Not concerned with format of messages or data.

– Transmits simple text messages only.

  • SMTP uses information written on envelope of mail.

3

– Message header

  • Does not look at contents.

– Message body

  • Except:

– Standardize message character set to 7 bit ASCII. – Add log information to start-of-message.

  • Shows path taken.
slide-4
SLIDE 4

Basic Operation

  • Mail created by user agent program (mail

client).

– Message consists of:

  • Header containing recipient’s address and other

4

Header containing recipient’s address and other information.

  • Body containing user data.
  • Messages queued and sent as input to

SMTP sender program.

– Typically a server process (daemon on UNIX).

slide-5
SLIDE 5

SMTP Mail Flow

5

slide-6
SLIDE 6

Mail Message Contents

  • Each queued message has:

– Message text

  • RFC 822 header with message envelope and list of

recipients.

6

  • Message body, composed by user.

– A list of mail destinations

  • Derived by user agent / SMTP server from header.
  • May be listed in header.
  • May require expansion of mailing lists.
slide-7
SLIDE 7

SMTP Sender

  • Takes message from queue.
  • Transmits to proper destination host.

– Via SMTP transaction. – Over one or more TCP connections to port 25.

7

– Over one or more TCP connections to port 25.

  • When delivery complete, sender deletes

destination from list for that message.

  • When all destinations processed,

message is deleted.

slide-8
SLIDE 8

Possible Errors

  • Host unreachable
  • Host out of operation
  • TCP connection fail during transfer
  • Sender can re-queue mail

8

Sender can re-queue mail

– Give up after a period

  • Faulty destination address

– User error – Target user address has changed – Redirect if possible – Inform user if not

slide-9
SLIDE 9

SMTP Receiver

  • Accepts arriving message.
  • Places in user mailbox or copies to outgoing

queue for forwarding.

  • Receiver must:

9

– Verify local mail destinations. – Deal with errors

  • Transmission
  • Lack of disk space
  • Sender responsible for message until receiver

confirm complete transfer.

– Indicates mail has arrived at host, not user.

slide-10
SLIDE 10

SMTP Forwarding

  • Mostly direct transfer from sender host to

receiver host.

  • May go through intermediate machine via

forwarding capability.

10

forwarding capability.

– Sender can specify route.

slide-11
SLIDE 11

SMTP Mail Flow

11

slide-12
SLIDE 12

SMTP System Overview

  • Commands and responses between

sender and receiver.

  • Initiative with sender.

– Establishes TCP connection.

12

– Establishes TCP connection.

  • Sender sends commands to receiver.

– e.g. HELO <domain><CRLF>

  • Each command generates exactly one

reply.

– e.g. 250 requested mail action ok; completed.

slide-13
SLIDE 13

SMTP Replies

  • Leading digit indicates category.

– Positive completion reply (2xx) – Positive intermediate reply (3xx) – Transient negative completion reply (4xx)

13

– Transient negative completion reply (4xx) – Permanent negative completion reply (5xx)

slide-14
SLIDE 14

Operation Phases

  • Connection setup
  • Exchange of command-response pairs
  • Connection termination

14

slide-15
SLIDE 15

Connection Setup

  • Sender opens TCP connection with receiver.
  • Once connected, receiver identifies itself.

– 220 <domain> service ready

  • Sender identifies itself.

15

– HELO

  • Receiver accepts sender’s identification.

– 250 OK

  • If mail service not available, the second step

above becomes:

– 421 service not available

slide-16
SLIDE 16

Mail Transfer

  • Sender may send one or more messages to

receiver.

  • MAIL command identifies originator.

– Gives reverse path to be used for error reporting. – Receiver returns 250 OK or appropriate fail/error

16

– Receiver returns 250 OK or appropriate fail/error message.

  • One or more RCPT commands identifies

recipients for the message.

– Separate reply for each recipient.

  • DATA command transfers message text.

– End of message indicated by line containing just period (.)

slide-17
SLIDE 17

Closing Connection

  • Two steps:

– Sender sends QUIT and waits for reply. – Then initiate TCP close operation.

  • Receiver initiates TCP close after sending

17

  • Receiver initiates TCP close after sending

reply to QUIT.

slide-18
SLIDE 18

An Example SMTP Session

S: 220 hotmail.com Simple Mail Transfer Service Ready C: HELO yahoo.com S: 250 hotmail.com C: MAIL FROM: <isg@yahoo.com>

18

C: MAIL FROM: <isg@yahoo.com> S: 250 OK C: RCPT TO: <myfriend@hotmail.com> S: 250 OK C: RCPT TO: <somebody@hotmail.com> S: 250 OK

slide-19
SLIDE 19

C: DATA S: 354 Start mail input; end with (.) C: … actual contents of the message … C: ……… C: ………

19

C: ……… C: (.) S: 250 OK C: QUIT S: 221 hotmail.com Service closing transmission channel

slide-20
SLIDE 20

Mail Access Protocols

  • Two mail access protocols are widely

used:

  • 1. Post Office Protocol, version 3 (POP3)
  • 2. Internet Mail Access Protocol version 4

20

  • 2. Internet Mail Access Protocol version 4

(IMAP4).

slide-21
SLIDE 21

POP3

  • The client POP3 software is installed on

the recipient machine, and the server POP3 software installed on mail server.

– The client (user agent) opens a connection

21

– The client (user agent) opens a connection with the server on TCP/110. – Sends user name and password. – Can access the mails, one by one. – Two modes:

  • Delete mode – mails deleted as they are read
  • Keep mode – mails remain in the mailbox
slide-22
SLIDE 22

IMAP4

  • Provides the following extra features:

– A user can check the email header before downloading. – A user can search the contents of the email for

22

A user can search the contents of the email for a specific string prior to downloading. – A user can create, delete, or rename mailboxes

  • n the mail server.

– A user can create a hierarchy of mailboxes in a folder for email storage.

slide-23
SLIDE 23

Multipurpose Internet Mail Extension (MIME)

  • SMTP can not transmit nontext / executables.

– Uuencode and other schemes are available.

  • Not standardized.
  • Cannot transmit text including international

characters (e.g. â, å, ä, è, é, ê, ë).

23

characters (e.g. â, å, ä, è, é, ê, ë).

– Need 8 bit ASCII.

  • Servers may reject mail over certain size.
  • Some SMTP implementations do not adhere to

standard.

– CRLF, truncate or wrap long lines, removal of white space, etc.

slide-24
SLIDE 24

Overview of MIME

  • Five new message header fields:

– MIME version – Content type – Content transfer encoding

24

– Content transfer encoding – Content Id – Content Description

  • Number of content formats defined.
  • Transfer encoding defined.
slide-25
SLIDE 25

Content Types

  • Text body
  • Multipart

– Mixed, Parallel, Alternative, Digest

  • Video

– mpeg

  • Audio

– Basic

25

  • Message

– RFC 822, Partial, External-body

  • Image

– jpeg, gif Basic

  • Application

– Postscript – octet stream

slide-26
SLIDE 26

MIME Transfer Encodings

  • Reliable delivery across wide largest range of

environments.

  • Content transfer encoding field:

– Six values – Three (7bit, 8bit, binary) no encoding done

26

– Three (7bit, 8bit, binary) no encoding done

  • Provide info about nature of data
  • Quoted-printable

– Data largely printable ASCII characters. – Non-printing characters represented by hex code.

  • Base64

– Maps arbitrary binary input onto printable output.

  • X-token

– Named nonstandard encoding.

slide-27
SLIDE 27

Base 64 Encoding

27

  • Expands the message by 33%.
  • Uses the symbols A..Z,a..z,0..9,+,/