2.4 MIME and Transfer encoding

MIME and Transfer Encoding

MIME

1

3

Message Format: Multimedia Extensions

? MIME: Multimedia Internet Mail Extension, RFC 2045-49, 2056 ~ an extension of RFC 822 for resolving prob. in SMTP/822 scheme

? additional lines in msg header declare MIME content type

(generated by user agent)

(header lines)

MIME version

From: kwk@csie.ntut.edu.tw To: kwk@en.ntut.edu.tw

method used to encode data

multimedia data type, subtype, parameter declaration

blank line

Subject: Test of E-Mail. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg

base64 encoded data ..... .........................

encoded data

......base64 encoded data

MIME

(RFC 2045/46 for more on headers) 3

3

E-Mail Message Format

? SMTP: protocol for exchanging email messages

? RFC 822: standard for text message format:

? header lines, e.g.,

? To: ? From: ? Subject: ? Message ID ? Date ? Received ? X-priority ? body ? the "message", 7-bit ASCII

characters only

MIME

header body

blank line

(details on next page)

2

3

MIME (Multipurpose Internet Mail Extensions) Types

Content-Type: type/subtype; parameters

Content-Transfer-Encoding: base 64

Audio

1. Rxer convert msg's body to ? exampe subtypes: basic (8-bit

its original non-ASCII first

mu-law encoded), 32k ADPCM

(32 kbps coding)

2. Then, uses type to determine Video

what actions it should take

? example subtypes: mpeg,

Type/subtype : Text

? example subtypes: plain, html

Image

quicktime

Application

? other data that must be processed by reader before "viewable"

? example subtypes: jpeg, gif

? example subtypes: msword,

octet-stream, pdf, ps

MIME(To register Types to IANA: see RFC 2048)

4

MIME References

? RFC 2045 ? MIME (Multipurpose Internet Mail Extensions) Part One: Format of Internet Message Bodies

? RFC 2046 ? MIME (Multipurpose Internet Mail Extensions) Part Two: Media Types

? RFC 2047 ? MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text

? RFC 2048 ? MIME (Multipurpose Internet Mail Extensions) Part Four: Registration Procedures

? RFC 2049 ? MIME (Multipurpose Internet Mail Extensions) Part Five: Conformance Criteria and Examples

? RFC 2156 ? MIXER (MIME Internet X.400 Enhanced Relay): Mapping between X.400 and RFC 822/MIME

? RFC 2159 ? A MIME Body Part for FAX

? RFC 2183 ? Communicating Presentation Information in Internet Messages

? RFC 2231 ? MIME Parameter Value and Encoded Word Extensions

MIME

5

3

MIME Content - Transfer Encoding

? Transfer encodings for message bodies to provide reliable delivery across the largest networking environment ? provide human readable and reasonable compact

Encoding Schemes

No encoding

3

Example - Multipart Type

From: kwke@ntut.edu.tw To: kwk@en.ntut.edu.tw Subject: test of multipart type

(containing many objects) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=98766789

Part I

--98766789 ? Separation begin with " - - " Content-Transfer-Encoding: quoted-printable

Content-Type: text/plain

Dear ALL, Please study

hard

on

end with " CR LF Networking course.

?"

--98766789

Content-Transfer-Encoding: base64

Content-Type: image/jpeg

Part II base64 encoded data .....

.........................

......base64 encoded data

MIME --98766789-- ? End of the last part

6

Transfer Encoding Selection

Example - Outlook Express

Choose here

(x ~ vender/application specific)

MIME

7

MIME

8

3

Quoted-Printable Encoding

? Encoding data consisting largely of printable ASCII characters

~ represents non-mail safe characters by hexadecimal representation of their code and introduce reversible (soft) line breaks to limit message lines to 76 characters (or less).

? Q.P. encoding rules:

? General 8-bit representation

~ used when none of following rules apply Explained

? Literal representation

next page

? White space

? Line breaks

~ use " CR LF " combination (i.e., 0D0AH)

? Soft line breaks

"="

~ for lines > 76 char., (excluding CR,LF), inserts " 3D0D0A " at

or before character position 75 (called soft line break).

MIME

9

3

Quoted-Printable Encoding (cont'd)

? General 8-bit representation

? any character ? "=" + " two-digit hexadecimal representation of the octet's value "

? Ex: 8-bit value "12" ? "=0C"

? Literal representation

? any character in the decimal range 33 ("!", 21H) to 126("~", 7EH) ? represented as that ASCII character

? Exception: 61 ("=", 3DH)

? White space

? "tab" ? octet value : 9 ()

? "blank" ? octet value : 32 ()

IRA

? Exception: "tab" and "blank" at the end of a line ? (encoding) using Gen. 8-bit repre.

example

(decoding) delete any trailing white space (HT and BS)

MIME

11

"Quoted" means . . .

? Using the equal sign (" = ") as a quote character to indicate both the non-mail safe characters and soft line break

? Quoted-printable is an encoding using ASCII characters for non-ASCII text. It is defined as a MIME content transfer encoding for use in Internet e-mail.

MIME

10

3

Base64/Radix-64 Encoding

? Encoding arbitrary binary data to be invulnerable to the processing by mail transport programs : that does not consist mainly of text characters - Process in a 3-octet (24-bit) basis - every 6-bit mapped to 8-bit codeword/character

No "-" ;

No ctrl char.

RFC 1421, 2045

MIME

(26 + 1)'s

printable characters

Ex.

12

3

Base-64 Example

6-bit 6-bit 6-bit 6-bit

base64 base64 base64 base64

Char. 1 Char. 2 Char. 3 Char. 4

? Example

IRA

00100011 01011100 10010001

001000 110101 110010 010001

I

1 y

R

A block of 24-bit raw data

* no control characters in the set for traversing mail-handling systems that

4 characters for transferring scan the data for control characters.

MIME

13

E-mail Example ? 1 (7-bit ASCII)

From: "kai-wei ke" To: Cc: "Elton John" Subject: Mail test Date: Sun, 17 Mar 2002 22:09:43 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed;

boundary="---=_NextPart_000_0009_01C1CE00.713E1360" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C1CE00.713E1360 Content-Type: text/plain;

charset="big5" Content-Transfer-Encoding: 7bit

This is a test of MIME encoding stuff. You must look at the encoded form for details.

(cont'd on next page) Kai-Wei

MIME

= NextPart 000 0009 01C1CE00 713E1360

15

E-mail in Details

If Double clicking

Press Right botton

MIME

(next pages) 14

Example ? 2 (base64)

Content-Type: text/plain; name="test.txt"

Ex-1(cont'd)

Content-Transfer-Encoding: 7bit

From: "kai-wei ke"

Content-Disposition: attachment;

To:

filename="test.txt"

Cc: "Elton John"

Subject: Mail test

This is a test of MIME attachment.

Date: Sun, 17 Mar 2002 22:49:15 +0800

MIME-Version: 1.0 Content-Type: multipart/mixed;

------=_NextPart_000_0009_01C1CE00.713E1360--

boundary="----=_NextPart_000_0075_01C1CE05.F702D1C0"

X-Priority: 3

X-MSMail-Priority: Normal

X-Mailer: Microsoft Outlook Express 6.00.2600.0000

X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

This is a multi-part message in MIME format.

------=_NextPart_000_0075_01C1CE05.F702D1C0 Content-Type: text/plain;

charset="Windows-1252" Content-Transfer-Encoding: base64

Exercise

VGhpcyBpcyBhIHRlc3Qgb2YgTUlNRSBlbmNvZGluZyBzdHVmZi4NCllvdSBtdXN0IGxvb2sgYXQg dGhlIGVuY29kZWQgZm9ybSBmb3IgZGV0YWlscy4NCg0KS2FpLVdlaQ==

------=_NextPart_000_0075_01C1CE05.F702D1C0

MIME

16

3

QP Example

= 4 blank 7 blank follows

MIME

IRA Control Characters

Format Control

International Reference Alphabet (or IAC)

Vertical Formatting

Control characters

17

MIME

For 8-bit ASCII, b8 ?even/odd parity bit or just zero

18

IRA Control Characters

Information Separator

Transmission Control

MIME

19

MIME

Miscellaneous

20

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download