Professional Documents
Culture Documents
April 3rd Lecture Presentation
April 3rd Lecture Presentation
Computer Networks
1
Protocol Suites
4
RFC 822 (1982)
• Format for text messages
• Message is sequence of lines of
text
—Uses general memo framework
—A header line is of form
keyword : arguments/values
To: cc: Bcc:
Subject:
Date:
And others
5
Relaying
• In SMTP terms, relaying means asking an SMTP sender to
deliver an email on behalf of:
— another SMTP server, or
— an email client
• It is like asking someone at the airport to take and deliver your
luggage
• Relaying is quite dangerous since it is one of the main enablers
of spam
— sending SMTP servers should enable relaying only for local senders
• Can be checked via domain name control
• May require authentication
6
Relaying
Relaying
7
8
9
Sender: Paketiniz=araskargo.com.tr@cesare.edu.mx
Date: Tue, 21 Mar 2023 09:11:36 +0000
Mime-Version: 1.0
Subject: Paketiniz ücretlerin ödenmesini bekliyor
From: Aras kargo <Paketiniz@araskargo.com.tr>
To: kursat@metu.edu.tr
Message-Id:
<20230321091136.62266e2b1468d044@cesare.edu.mx>
10
Lets check
11
Lets Try SMTP interaction :
telnet <servername> 25
see 220 reply from server
enter HELO, MAIL FROM:, RCPT TO:, DATA, QUIT
commands
above lets you send email without using e-mail client (reader)
Note: this will only work if <servername> allows telnet connections to port 25 (this is
becoming increasingly rare because of security concerns)
Multipurpose Internet Mail Extension (MIME)
- RFC2045-2049 – in 1996
• SMTP is only for 7-bit ASCII text messages (128 characters), can not
transmit executables!!!
—Uudecode - Uuencode and other schemes are available - translate a binary
file that contains unprintable (non-text) characters into a format that is
entirely readable
• Not standardized
• Cannot transmit text including international characters (e.g. ö, ç, ğ,
â, å, ä, è, é, ê, ë)
• MIME is intended to solve these problems
—to be used over SMTP - compatible with RFC 822
• MIME is actually a framework to handle attachments
• Mainly handled by e-mail client
13
Overview of MIME
• MIME is not only for e-mail, also used for Web/HTTP
• New message header fields (to be included in RFC 822 header)
—MIME version
—Content type
• description for the data (text, audio, video, image, etc..)
—Content transfer encoding
• Data should be encoded such that SMTP can carry (what data type SMTP carry?)
• This field describes the encoding mechanism used
—Content Description
• plain text description for the object in the body
• optional, used when an explanation for the attachment is needed
14
Content Types (some of them)
• Text body (unformatted plain text)
— ASCII or ISO 8859 charset
— a different charset may be defined at content-type header field
• Multipart
— multiple independent parts, each may be of different type
— separated by a boundary (a random-like string) for which value is defined at content-type
header field
— Four subtypes: Mixed, Parallel, Alternative, Digest
— Multipart/mixed different parts bundled in a particular order
— Multipart/parallel different parts but the order is not important (e.g. Videos)
— Multipart/alternative same content but alternative representations (e.g. http, OS players)
• Message/RFC822 (for forwarded messages)
— the content is an entire message (including header and body)
— despite its name, the embedded message can be of any MIME type
15
Content Types (some of them)
• Image
—jpeg, gif, etc.
• Video
—Mpeg, etc.
• Audio
• Application
—binary data to be processed by an external application
• attachments of any type
—application name is a subpart
• msword, postscript, pdf, etc.
16
MIME Transfer Encoding
• Reliable delivery across various environments
• Content-transfer-encoding field
— Six alternative methods (some for HTTP)
— For three of them (7bit, 8bit, binary)
— Only 7-bit is safe for SMTP
• Quoted-printable UTF-8 (e.g. kürşat k=C3=BCr=C5=9Fat )
— Useful when data are mostly printable ASCII characters
—e.g. ö, ç, ğ, â, å, ä, è, é, ê, ë
— Non-printable characters represented by hex code
— UTF-8 Unicode Transformation Format-8 https://www.charset.org/utf-8
• Base64 (Radix-64)
— Maps arbitrary binary input onto printable output (33% overhead)
17
Lets check an email
18
To: Kursat <kursat@metu.edu.tr>
Content-Type: multipart/mixed; boundary="000000000000e248b805f9242ea9«
--000000000000e248b605f9242ea7
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: base64
<div dir=3D"ltr">k=C3=BCr=C5=9Fat<div><br></div></div>
--000000000000e248b805f9242ea9
Content-Type: image/jpeg; name="ataturk.jpg"
Content-Disposition: attachment; filename="ataturk.jpg"
Content-Transfer-Encoding: base64
/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAs
19
K
20
Binary Base64 Binary
22
Base64/Radix-64 Encoding Table
23
Example: a JPEG file to text
• FFD8FFE000... Each hexadecimal digit corresponds to 4 binary digits
• First three bytes, FFD8FF, are the JPEG file signature, and the
following, E000, contains metadata such as the image size and
format version.
• F F D 8 F F
• 11111111 11011000 11111111
24
25
26
Padding: To ensure that the string length is a multiple of four! 27
Lets Check with an example
28