Docsity

Introducción a Internet: Protocolos de Correo Electrónico (Email) y MIME, Apuntes de Aplicaciones Multimedia

Vista previa parcial del texto

¡Descarga Introducción a Internet: Protocolos de Correo Electrónico (Email) y MIME y más Apuntes en PDF de Aplicaciones Multimedia solo en Docsity!

P. 1

E-MAIL SERVICE

Email service Email service P. 2

Index

• Introduction

• Services and architecture

• Message format (RFC 822 , MIME)

• Message transfer: SMTP, ESMTP

• Final delivery: POP 3 , IMAPv 4

Email service P. 3

BIBLIOGRAPHY

  • Basic:
    • “TCP/IPProtocolSuite”, 3 a Ed. B. Forouzan, McGraw-Hill, 2003. (Chapter 20 ).
    • “TCP/IPTutorialandTechnicalOverview”.IBMRedbook. 2006. (Chapter 15 ).
  • Advanced:
  • “ComputerNetworking:ATop - DownApproachFeaturingtheInternet”, 3 a Ed. J.F. Kurose and K. W. Ross. Addison-Wesley. 2005. (Chapter 2 ).
  • “Internete - mail-protocols,standards,andimplementation”.L.Hughes. Artech House Publishers, 1998.
  • RFCs:
  • RFC 821 : Simple Mail Transfer Protocol.
  • RFC 822 : Standard for the Format of ARPA Internet Text Messages.
  • RFC 1939 : Post Office Protocol - Version 3.
  • RFC 2045 : Multipurpose Internet Mail Extensions (MIME) Part One.
  • RFC 2046 : Multipurpose Internet Mail Extensions (MIME) Part Two.
  • RFC 3501 : Internet Message Access Protocol - Version 4 rev 1 Email Service P. 4

Introduction

  • Exchange of messages among users
    • Very popular application
    • Increase of productivity 30 %(estimationfrom’ 92 )
  • History:
    • Since more that 20 years
      • Email extension in multiuser systems
    • At the beginning it was file transfer, with an initial line added with the destination address
      • Limitations: Uncomfortable to send the same email to several recipients; files had no internal structure, impossible to send a mixture of text, voice, video; no confirmation of receipt; poor user interfaces
    • 1982 : ARPANET email proposal
      • RFC 822 : message format
      • RFC 821 : transmission protocol
    • 1984 : CCITT X. 400 draft
      • 1988 : modifications towards MOTIS (OSI)
    • 1990 : RFC 822 / 821 “wins”X. 400 (disappeared)
    • ResponsibleofthefirstInternet“boom”
      • (Cáceres 1991 ): 50 % TCP connections due to email
      • Today, 10 % traffic is email
    • 90 s: improvements, extensions, new protocols
    • Today: spam crises?
    • We will concentrate on Internet email (RFC 821 , 822 )

RFC 822 P. 7

Message format: RFC 822

  • RFC 822 :“StandardformatfortextmessagesinInternet”;i.e.,ASCII
    • 1982
    • Exchange format (can be stored in a different format in queues and mailboxes)
  • Structure:
    • Headers
      • format: header_name: header_value
      • All characters are NVT ASCII
      • In principle each header in one line, though they may be fold
        • Replace whitespace by +whitespace
      • Order unspecified
      • Generated by UA, or added by traversed MTAs
      • Only interpreted at the destination UA (not MTAs!)
    • White line ()
    • Message body
      • NVT ASCII, only text
        • Later MIME extension allowed other content types
        • No compression
        • Maximum of 1000 chars per line (limit imposed by DATA command in RFC 821 ) Email service P. 8 Delivered-To: [email protected] Received: by 10.42.246.9 with SMTP id lw 9 csp 157724 icb; Mon, 5 Nov 2012 04: 34 : 19 - 0800 (PST) Received: by 10.180.7.197 with SMTP id l 5 mr 13139065 wia.13.1352118858931; Mon, 05 Nov 2012 04 : 34 : 18 - 0800 (PST) Return-Path: Message-ID: < 5097 [email protected]> Date: Mon, 05 Nov 2012 13: 34 : 16 + 0100 From: =?ISO- 8859 - 1 ?Q?Marisa_P=E 9 rez?= User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/ 20121026 Thunderbird/16.0. Reply-To: To: [email protected] Subject: mensaje de prueba X-Mailer: Mozilla 4.51 [es] (Win 98 ; U) This is a test With several lines

RFC 822 P. 9

Some headers in RFC 822

  • Trace fields (added by traversed MTA):
    • Received:["from”sendinghost][byreceivinghost]*("with"mailprotocol)["id" msg- id] ["for" address] ";" date-time received
  • Reference fields (origin MTA):
    • Message-ID:
  • Between UAs:
    • Date: date and time when message was sent
    • From: source address
      • There may be several addresses if a Sender header is present
    • Rply-To: address for replies (if not present, From header will be used)
    • To: Cc: message destinations (one or several addresses separated by commas)
    • Bcc: blind list of destinations
    • Subject
    • Users, Uas, or MTAs, may invent their own experimental headers (X-...)
    • Adress formats may be
      • address@domain
      • Name FamilyName
      • “Name FamilyName” address@domain MIME P. 10

Limitations of RFC 822

  • Message body limited to NVT ASCII
    • Most languages unsupported: latin and non-latin...
    • Other media unsupported: images, sound, video
  • Line size limited to 1000 chars
  • Limitations imposed by implementations:
    • Total size limited
      • How to fragment/split a message?
    • Whitespace removal at the end of the message
    • Lines > 76 chars folded
    • replaced by
    • Some replace by several whitespaces
  • MIME includes mechanisms to solve these problems
    • Originally RFC 1341 ( 1992 ).
    • RFC 2045 and following MIME related RFCs

MIME P. 13

Content-Type (II)

● Image

― image/jpeg ― image/gif

● Audio

― audio/basic: mono, 8 bit, 8 KHz, mu law

● Video

― video/mpeg

● Application: other data types

― application/octect-stream : non-interpreted byte sequence ― application/postScript : document printable in postscript MIME P. 14

Content-Transfer-Encoding

  • Allows sending a non NVT ASCII message body
  • New header with five possible values (though only two new encodings quoted- printable and base 64 ): - ASCII 7 bits, Message originally compliant with RFC 822 - 8 bits with 1000 characters as line limit (MTAs support 8 - bit-MIMETransport) - Binary (only leagl for Content-Type: message/external-body) - quoted-printable - Charactersrepresentedas“=“followedbytwohexadecimaldigits,representingthe octet value - Characters ( 33 - 60 , 62 - 126 ) can be directly represented in ASCII ('=' by = 3 D) - tabsandwhitespaceatendoflineencodedby“= 09 ”or“= 20 ” - Lines larger that 76 charactersaredividedsetting“=“asthelastcharacter - Base 64 encoding - each 24 bits are split in 4 groups of 6 bits - pad if necessary and indicate to the other end with extra '=' - line length 76 chars

MIME P. 15

Quoted Printable

• Text encoded should be mostly readable

  • Text with few non NVT ASCII chars (like a message in spanish)

• Encoding rules:

  • Anybyte(inhexXY)isencodedas“=XY”
    • But the end of line () which is encoded as ( 0 x 0 D 0 A)
  • Chars in range 33 - 126 ( 0 x 21 - 0 x 7 E) are not changed
    • But char 61 correspondingtosymbol'='isencodedas“= 3 D”
  • Tab ( 0 x 09 ) and whitespace ( 0 x 20 ) are not changed
    • Butattheendofaline“= 09 ”“= 20 ”
  • Line length limited to 76 chars (excluding )
    • Ifalineislonger,includeasoftendofline“=”

( 0 x 3 D 0 D 0 A)

MIME P. 16

Example

Content-Type: text/plain; charset=ISO- 8859 - 1

Content-Transfer-Encoding: quoted-printable

Buenos d=EDas:

=A 0 =A 0 =A 0 Por indicaci=F 3 n del Rector, os convoco a una comida en su

comedor de Rectorado=A 0 (junto a su despacho de Getafe) el

lunes d=EDa 8 de marzo a las=

14 : 30 horas.

MIME P. 19

Some considerations on

Content-Transfer-Encoding

• This header only applies to message body

  • Does not apply to header values
    • For instance to have an 'ñ' in the Subject:
  • Multipart messages may have different encoding for each part
    • If not present the default encoding is assumed: 7 bit
  • The Content-Type does not condition a given encoding MIME P. 20

Non ascii values in headers: RFC 1342

  • From, To, Subject...
  • Obsoleted by RFC 2047

• =?charset?encoding?encoded-text?=

  • charset : us-ascii, iso- 8859 - x, etc.
  • encoding : a B/Q char, denoting:
    • B: Base 64 encoding
    • Q: quoted-printable encoding
      • Difference:whitespaceas“_”
  • encoded-text : text encoded

• Examples:

Subject: =?ISO- 8859 - 1 ?Q?Feliz_a=F 1 o?= From: =?US-ASCII?Q?Keith_Moore?= To: =?ISO- 8859 - l?Q?Kelcl_J=F 8 rn_Simonsen?= CC: =?ISO- 8859 - l?Q?Andr=E 9 _?= Pirard Subject: =?ISO- 8859 - 1 ?B?SWYgeW 911 GNhbiRoaXMgeW 8 =?= =?ISO- 8859 - 2 ?B?dSBIbinRlcnNOYW 5 klHRoZSxlLg==?=

MIME P. 21

Example I

MIME P. 22

Example (II)

SMTP P. 25

SMTP commands

  • Hello:
    • To identify the origin to the destination
    • **HELO **
  • Mail:
    • To start an email transaction
    • MAIL FROM:
  • Recipient:
    • To specify one email recipient
    • **RCPT TO: **
  • Data:
    • To send the message (rfc 822 , MIME)
    • **DATA **
  • Quit:
    • To tell the recipient to send OK and close the connection
    • **QUIT **
      • Reset:
        • Aborts current email transaction
        • **RSET **
      • Verify:
        • Asks destination if there is any user

        • **VRFY **

      • NOOP:
        • No operation. The destination answers “ 200 :OK”.
        • NOOP SMTP P. 26

SMTP: optional commands

– Expand:

  • Asks the destination to confirm if the email list exists
  • **EXPN **

– Help:

  • Sends list of available commands or information about the command
  • **HELP [] **

– Turn:

  • Exchanges the roles of origin (client) and destination (server)
  • No new establishment of TCP connection required
  • **TURN **

SMTP P. 27

SMTP: optional commands (contd.)

• Rarely implemented (can be used instead of MAIL)

  • Send:
    • Sends the message to the terminal
    • **SEND FROM: **
  • Send or mail:
    • If it is connected, send the message to the terminal, otherwise via

email

  • **SOML FROM: **
  • Send and mail:
  • To the terminal and via email
  • SAML FROM: SMTP P. 28

Example SMTP responses

SMTP P. 31

SMTP: command sequence III

• Saying goodbye

  • C: QUIT
  • R: 221 Service closing transmission channel
    • Error: 500

• Closing of connection

SMTP P. 32

Normal Transaction

SMTP P. 33

Example: Verify before sending

SMTP P. 34

Example: Reset

SMTP P. 37

Mail relaying with RCPT TO

  • RCPT TO may (partially) specify a delivery route (mail relays)- OBSOLETE
    • RCPT TO: @host-a,@host-b:user@host-c SMTP P. 38

Mail relaying (II)

SMTP P. 39

Why mail relaying?

• Source UA may send it directly to destination MTA

• Most often it is not send directly but through several hops

  • UAs usually configured to use a mail gateway (smarthost)
  • Usually a MTA is configured as the single entry/exit point in the organization - Allowed by firewall to receive connections in port 25 - Control spamming from our domain - It is the destination dns MX RR - It delivers mail to the MTA of the intranet - Common view of the organization: [email protected] - Restrict incoming spam easier (antivirus...)

• When no response from any MTA in dns MX RR

  • Keep on trying for at least 30 min, 4 - 5 days (RFC 1123 - Requirements for Internet Host) SMTP P. 40

Relay MTAs (intermmediate MTAs)

  • Accept connections from our domain to send mail to any destination address,

and

  • Accept connections from any outside client to send mail to destination addresses

in our domain