Basics BUPT/QMUL

Similar documents
Basics BUPT/QMUL

Agenda. What is ? Brief Introduction To . History Of . Components Of System. Basics

SMTP. George Porter CSE 124 February 12, 2015

Electronic Mail (SMTP)

Application: Electronic Mail

Electronic Mail. Prof. Indranil Sen Gupta. Professor, Dept. of Computer Science & Engineering Indian Institute of Technology Kharagpur

Internet and Intranet Protocols and Applications

Applications & Application-Layer Protocols: FTP and (SMTP & POP)

Simple Network Management Protocol (SNMP)

Internet Technology. 03r. Application layer protocols: . Paul Krzyzanowski. Rutgers University. Spring 2016

Electronic Mail

Simple Network Management Protocol (SNMP)

Lecture 6: Application Layer Web proxies, , and SMTP

Lecture 25. Tuesday, November 21 CS 475 Networks - Lecture 25 1

Electronic Mail Paradigm

Electronic mail, usually called , consists of simple text messages a piece of text sent to a recipient via the internet.

WWW: the http protocol

System: Basic Functionality

CSC 4900 Computer Networks:

SCS3004 Networking Technologies Application Layer Protocols

CompSci 356: Computer Network Architectures. Lecture 23: Application Layer Protocols Chapter 9.1. Xiaowei Yang

The Application Layer: & SMTP

Electronic Mail. Electronic Mailboxes

Networking. Layered Model. DoD Model. Application Layer. ISO/OSI Model

Layered Model. DoD Model. ISO/OSI Model

Internet Electronic Mail

Outline. EEC-484/584 Computer Networks. Slow Start Algorithm. Internet Congestion Control Algorithm

What is ? TCP/IP Standard Applications for Electronic Mail. Agenda. History

Chapter 7 (Week 13) The Application Layer ANDREW S. TANENBAUM COMPUTER NETWORKS FOURTH EDITION PP BLM431 Computer Networks Dr.

13. Internet Applications 최양희서울대학교컴퓨터공학부

Network Applications Electronic Mail

CSCE 463/612 Networks and Distributed Processing Spring 2018

The Application Layer: SMTP, FTP

Lecture 7 Application Layer. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

CS 43: Computer Networks. 12: and SMTP September 28, 2018

. indigoo.com INTRODUCTION TO MAIL TRANSFER PROTOCOLS FOR THE INTERNET. Peter R. Egli INDIGOO.COM. 1/35 Rev Peter R.

The Application Layer

Debian/GNU Linux Mailing

Chapter 2 Application Layer

Motivation For Networking. Information access Interaction among cooperative application programs Resource sharing

. SMTP, POP, and IMAP

Chapter 20 SMTP. Slides from TCP/IP - Forouzan. User Agent (UA) Addressing Delayed Delivery Aliases Mail Transfer Agent (MTA) MIME POP.

Computer Network 1 1

Fig (1) sending and receiving s

Overview. Electronic mail. History Format of . Sending . Retrieving . RFC 822, MIME, addresses SMTP, DNS. POP, IMAP, Web-based

INTERNET & WORLD WIDE WEB (UNIT-1) MECHANISM OF INTERNET

How Internet Works

Objectives CINS/F1-01

Application Inspection and Control for SMTP

Protocols and Software. Nixu Ltd.

Electronic Mail. Three Components: SMTP SMTP. SMTP mail server. 1. User Agents. 2. Mail Servers. 3. SMTP protocol

Debian/GNU Linux Mailing

ECE 435 Network Engineering Lecture 6

FTP. FTP offers many facilities :

Telemetry Data Sharing Using S/MIME

Application-layer Protocols and Internet Services

Internet Technology 2/10/2016

Header- A Forensic Key to Examine an

Chapter 2: outline. 2.6 P2P applications 2.7 socket programming with UDP and TCP

CIT 470: Advanced Network and System Administration. Topics. Mail Policies.

is still the most used Internet app. According to some studies around 85% of Internet users still use for communication.

[Prof. Rupesh G Vaishnav] Page 1

Investigating . Tracing & Recovery

ing With PHP History of Applications or Use

Internet Protocol Stack! Principles of Network Applications! Some Network Apps" (and Their Protocols)! Application-Layer Protocols! Our goals:!

2. Introduction to Internet Applications

Protocols. Networking CS 3470, Section 1 Sarah Diesburg

Computer Networking. Chapter #1. Dr. Abdulrhaman Alameer

Chapter 2 Application Layer

Information Network Systems The application layer. Stephan Sigg

Application Layer Chapter 2

DNS and SMTP. James Walden CIT 485: Advanced Cybersecurity. James WaldenCIT 485: Advanced Cybersecurity DNS and SMTP 1 / 31

Internet Protocols. Robin Sharp

CS348: Computer Networks (SMTP, POP3, IMAP4); FTP

Part 4: Message delivery protocols (POP and IMAP) Network News (Usenet News)

Network Services, VU 2.0

CCNA Exploration1 Chapter 3: Application Layer Functionality and Protocols

SMTP Simple Mail Transfer Protocol

Internet Architecture

Mail agents. Introduction to Internet Mail. Message format (1) Message format (2)

Who s Marcus? mail() 2008 Marcus Bointon

FTP. Mail. File Transfer Protocol (FTP) FTP commands, responses. Electronic Mail. TDTS06: Computer Networks

Chapter 2: Application layer

Application Layer Services Omer F. Rana. Networks and Data Communications 1

Applications FTP. FTP offers many facilities :

CS 3516: Computer Networks

What is ? A method of composing, sending, and receiving messages over electronic communication systems. Internet addresses

Additional laboratory

COSC 301 Network Management. Lecture 14: Electronic Mail

CCNA Exploration Network Fundamentals. Chapter 03 Application Functionality and Protocols

ColdFusion Foundations: POP3. Mosh Teitelbaum evoch, LLC

Network Working Group Request for Comments: 1844 Obsoletes: 1820 August 1995 Category: Informational

Week 3: . Johan Bollen Old Dominion University Department of Computer Science

CHAPTER 22 DISTRIBUTED APPLICATIONS ANSWERS TO QUESTIONS ANSWERS TO PROBLEMS

Appendix. Web Command Error Codes. Web Command Error Codes

Internet Applications. Dr Steve Gordon ICT, SIIT

Text-Based Protocols. Many common protocols based on sending text messages. Built atop the TCP stream protocol. Lines terminated with \r\n.

Lecture 3. HTTP v1.0 application layer protocol. into details. HTTP 1.0: RFC 1945, T. Berners-Lee HTTP 1.1: RFC 2068, 2616

Expires July 1999 February 26, Simple Mail Transfer Protocol. draft-ietf-drums-smtpupd-10.txt. Status of this Memo

APPLICATION LAYER APPLICATION LAYER : DNS, HTTP, , SMTP, Telnet, FTP, Security-PGP-SSH.

Transcription:

Email Basics BUPT/QMUL 2017-05-08

Agenda Brief introduction to email Components of email system Email Standards Summary 2

Brief Introduction To Email 3

What is Email? Electronic Mail (email, e-mail) Provides a means to send electronic messages from one person to another asynchronously One of the most popular applications on the Internet and one of the most important communication methods today Email Poisoning Syndrome Incurs face-to-face communication impediment Email service can be provided by ISPs: @126.com, @163.com, @sina.com, @yahoo.cn, Corporations and institutes: @baidu.com, @bupt.edu.cn, @ietf.org, Bundled with other services: @139.com, @qq.com, 4

History Of Email ARPANET Internet 1971 1982 1984-1988 1988 1988 1993 1996 1996 the first email in the world RFC 821(SMTP) RFC 822 X.400 MOTIS Eudora POP IMAP MIME Outlook Free emails Ray Tomlinson IETF CCITT ISO Steve Dorner IETF IETF Microsoft Hotmail etc. Trends: Multiple data types other than text More Users More space, larger attachment Will email be replaced by Instant Messaging? Newest development: Oct. 2008 RFC 5321 Simple Mail Transfer Protocol RFC 5322 Internet Message Format 5

Components Of Email System 6

Components Of Email System (1) User Agent SMTP Mail SMTP Mail POP3 Server Server IMAP User Agent SMTP SMTP POP3,IMAP Sender UA Internet Receiver UA Spooling Mail Server of Sender Side User mailbox Mail Server of Receiver Side MTA MTA 7

Components Of Email System (2) UA (User Agent) end-user mail program Interface between the end users and the email servers E.g., outlook, foxmail, Mail Server Responsible for transmitting/receiving emails and reporting status information about mail transferring to the mail sender Both a SMTP client and a SMTP server Email protocols SMTP: used for sending an email POP3/IMAP: used for receiving an email 8

Components Of Email System (3) Transfer Composition Reporting Displaying SMTP SMTP Transfer Displaying Reporting Disposition POP3,IMAP Sender UA Internet Receiver UA Mail Server of Sender Side Mail Server of Receiver Side 9

Basic Functions Of Email System Composition - refers to the process of creating messages and answers. Transfer - refers to moving messages from the originator to the recipient. Reporting - refers to the process of informing the originator what happened to the message. Displaying - means of showing the messages. Disposition - refers to what happened to the message after it has been read by the receiver. 10

Other Terminologies Mailboxes created by the user to store incoming email. Mailing lists means of sending identical emails to a group MTA (Mail Transfer Agent) SMTP servers and clients provide a mail transport service 11

Email Sending To send an email message, a user must provide the message, the destination address and possibly some other parameters (e.g., security or security level) The message can be produced with a freestanding text editor, a word processor, or possibly with an editor built into the user agent 12

Email Address The destination address must be in a format that the user agent can deal with Many user agents expect DNS addresses of the form mailboxname@domain. (See RFC 5322) Each email address is unique on the Internet because Domain name is unique on the Internet Mailboxname is unique in the domain 13

Email Reading Typically, when a user agent is started up, it will look at the user s mailbox for incoming email before displaying anything on the screen Then it may announce the number of messages in the mailbox or display a oneline summary of each one and wait for a command 14

Email Standards 15

Email Standards Internet Message Format RFC 5322 etc. SMTP (Simple Mail Transfer Protocol) RFC 5321 etc. POP (Post Office Protocol) RFC 1939 etc. IMAP (Internet Message Access Protocol) RFC 3501 etc. MIME (Multipurpose Internet Mail Extension) RFC 2045-2049 etc. 16

Internet Message Format (1) Message envelop contains whatever information is needed to accomplish transmission and delivery Message contents: comprise the object to be delivered to the recipient Headers: from, to, subject, date, postmarks Blank line Body: actual message, may have many parts 17

Internet Message Format (2) Each header field consists of a single line of ASCII text containing the field name, a colon, and, for most fields, a value eg. from:abc@gmail.com In normal usage, the User Agent builds a message and passes it to MTA The MTA then uses some of the header fields to construct the actual envelope User provides body & key headers, while mail system provides the rest 18

Mailbox responsible for the actual transmission of the message, optional the address(es) of the primary recipient(s) of the message Internet Message Format Example RFC 5322 Message The header is everything up to the blank line, and the body is everything after the blank line Author of the message, required From: John Doe <jdoe@machine.example> Sender: Michael Jones <mjones@machine.example> To: Mary Smith <mary@example.net> Subject: Saying Hello headers Date: Fri, 21 Nov 1997 09:55:06-0600 Message-ID: <1234@local.machine.example> This is a message just to say hello. So, "Hello". body 19

Internet Message Format Field Definitions Categories Header Meaning Originator fields Destination address fields The origination date field Identification fields Information fields Trace fields From: Sender: Reply-to: To: Cc: Bcc: Date: Message-Id: References: Subject: Keywords: Received: Return-Path: Person or people who created the message Email address of the actual sender Email address to which replies should be sent Email address(es) of primary recipient(s) Email address(es) of secondary recipient(s) Email address(es) for blind carbon copies The date and time the message was sent Unique number for referencing this message later Other relevant Message-Ids Short summary of the message for the one-line display User chosen keyword Line added by each transfer agent along the route Can be used to identify a path back to the sender 20

SMTP The source machine establishes a TCP connection to Port 25 of the destination machine Listening to this port is an email daemon that speaks SMTP This daemon accepts incoming connections and copies messages from them into the appropriate mailboxes 21

SMTP If the message cannot be delivered, an error report containing the first part of the undeliverable message is returned to the sender eventually SMTP is a simple ASCII protocol After establishing the TCP connection to port 25, the sending machine, operating as a client, waits for the receiving machine operating as the server to talk first 22

SMTP Basic Model File System File System User MTA SMTP commands/replies and mail MTA SMTP client SMTP server 23

SMTP Command Sequence stages Connection establish Mail transfer Connection release 24

SMTP Commands: Basics commands HELO MAIL FROM: RCPT TO: DATA QUIT description identifies sender s Domain name starts a mail transaction and identifies the mail originator identifies individual recipient. There may be multiple RCPT TO: commands body of the message. sender ready to transmit a series of lines of text, each ends with \r\n. A line containing only a period. indicates the end of the data close the connection 25

SMTP Commands: Extras EHLO (Extended Hello) Same function with HELO. But, in addition to domain name, address literal (eg. IPv4 address) is also supported VRFY - confirm that a name is a valid recipient EXPN - expand an alias (group email address) NOOP - send back a positive reply code RSET - abort current transaction HELP - cause the server to send helpful information to the client 26

SMTP: Status Codes The Server responds with a 3 digit code that may be followed by text info 2## -- Success 3## -- Command can be accepted with more information 4## -- Command was rejected, but error condition is temporary 5## -- Command rejected, and the error condition is permanent, eg. Bad User! 27

SMTP Commands and Status codes example smith@alpha.edu sends a mail to jones@beta.gov, green@beta.gov Connection establish SMTP client TCP connection establish 220 beta.gov Simple Mail Transfer Service ready HELO alpha.edu 250 beta.gov SMTP server Mail transfer Connection release MAIL FROM: <smith@alpha.edu> 250 OK RCPT TO: <jones@beta.gov> 250 OK RCPT TO: <green@beta.gov> 550 No such user here DATA 354 Start mail input; end with <CR><LF>.<CR><LF> Message <CR><LF>.<CR><LF> 250 OK QUIT 221 beta.gov service closing transmission channel 28

Sending Email Through Telnet C:\Documents and Settings\Administrator> telnet smtp.163.com 25 220 163.com Anti-spam GT for Coremail System (163com[20141201]) helo mail.163.com 250 OK Base64 encoded username: and Password: auth login 334 dxnlcm5hbwu6 Y2F0c2hpeQ== 334 UGFzc3dvcmQ6 MTIzNDU2 235 Authentication successful mail from:<catshiy@163.com> 250 Mail OK rcpt to:<catshiy@163.com> 250 Mail OK data 354 Please start mail input. subject:test email Base64 encoded username catshiy Base64 encoded password 123456 Blank line: boundary between headers and body this is only a test for sending email through telnet. Period: end of data 250 Mail queued for delivery. quit 221 Bye. 失去了跟主机的连接 C:\Documents and Settings\Administrator> 29

Base64 Encoding Divides binary data into 24 bit blocks Each block is then divided into 6 bit chunks Each 6-bit section is interpreted as one character (8 bits), 25% overhead 30

Base64 Example hello 01101000 01100101 01101100 01101100 01101111 011010 000110 010101 101100 011011 000110 111100 (26) (6) (21) (44) (27) (6) (a) (G) (V) (s) (b) (G) (8) (=) agvsbg8= (60) 01100001 01000111 01010110 01110011 01100010 01000111 00111000 00111101 Online encoding and decoding: http://tools.jb51.net/tools/base64_decode-gb2312.php

Base64 Encoding Table 32

SMTP Transfer Mechanism Example Sender s SMTP SMTP Client UA Receiver SMTP User mailboxes TCP/IP network SMTP Server The SMTP server listens to wellknown port 25. SMTP is a reliable protocol. The reliability is achieved by using TCP as the transport layer mechanism. This requires a connection to be established before a message transfer can take place. An SMTP client will contact the destination host's SMTP server directly to deliver the mail. It will keep the mail item being transmitted until it has been successfully copied to the recipient's SMTP MTA. Eventually it may give up. 33

Limitations in SMTP Only uses ASCII format How to represent other data types? No authentication mechanisms Messages are sent un-encrypted Susceptible to misuse (Spamming, faking sender address) 34

POP Basic Model Used to transfer mail from a mail server to a UA Internet File System SMTP Server: is always on and listening via TCP port 25 holds incoming mail for user SMTP/POP Mail Server POP Mail Access Server: runs the POP3 service by listening on TCP port 110 SMTP POP User Agent Clients: connect to server to manipulate mail using message access protocols (POP or IMAP) 35

POP Features Essentially store and forward. Mail is stored on the server until the client connects and then is downloaded to the client. You MAY be able to leave a copy on the server Simple protocol and widely used. Many clients available such as Eudora, foxmail, outlook However, very bad for mobile users or users that use multiple machines during the day Common used version: POP3 (POP Version 3) 36

POP3 Similar to SMTP command/reply lockstep protocol Used to retrieve mail for a single user requires authentication Commands and replies are ASCII lines Replies start with +OK or -ERR Replies may contain multiple lines 37

POP3 Commands USER - specify username PASS - specify password STAT - get mailbox status number of messages in the mailbox. LIST - get a list of messages and sizes. One per line, termination line contains. only RETR - retrieve a message DELE - mark a message for deletion from the mailbox NOOP - send back positive reply RSET - reset. All deletion marks are unmarked QUIT - remove marked messages and close the (TCP) connection 38

Retrieving Emails Through Telnet (1) C:\Documents and Settings\Administrator> telnet pop3.126.com 110 +OK Welcome to coremail Mail Pop3 Server (126coms[3adb99eb4207ae5256632eecb8f8b4 85s]) USER catshiy +OK core mail PASS 123456 +OK 1 message(s) [885 byte(s)] STAT +OK 1 885 LIST +OK 1 885 1 885. 39

Retrieving Emails Through Telnet (2) RETR 1 +OK 885 octets Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Message-ID: <DQ958982777179.06131@mcard.bta.net.cn> Date: Sun, 17 Oct 2004 22:28:20 +0800 (CST) From: shp1234@public.bta.net.cn To: catshiy@126.com Cc: Subject: 我十一月中旬以后有空, 欢迎你们过来玩 shp ----------------------------------------------. QUIT +OK core mail 失去了跟主机的连接 C:\Documents and Settings\Administrator> 40

IMAP (Internet Message Access Protocol) Features Folders and messages can be stored either on the server or on the local computer Since folders can remain on server, it is possible to access your same mail store even using a dumb terminal character based client like Pine. Much better for mobile users than POP (since mail remains on the server) Can selectively copy (part of ) messages from the server to the local client based on many criteria QQ supports both IMAP and POP3 Interesting comparison of POP3 and IMAP http://www.its.qmul.ac.uk/mail/compare.html 41

POP vs. IMAP POP3: Internet All Messages IMAP: Dr.Amer Friends. Internet 42

POP vs. IMAP(2) 43

Web-based Mail: HTTP Can deliver mail message in web page format More reliable to use POP and IMAP than web mail account http://mail.bupt.edu.cn/ 44

MIME Motivation Originally, email consisted exclusively of the text messages written in English and expressed in ASCII (RFC 5322) Nowadays, this approach is no longer appropriate, due to: Messages in languages with accents (e.g. ö, ç, ğ) Messages in non-latin alphabets Messages in languages without alphabets Messages are not containing text at all -- audio/video MIME: Multipurpose Internet Mail Extension 45

MIME Features Extension for multipart & multimedia email Additional mail headers define content type (text, image, audio, video, application) and subtype within (eg text/html, image/gif) encoding (ASCII, quoted printable, base64) to handle arbitrary binary data when email system can only handle normal ASCII chars Supports multipart message content type each part has its own type and encoding The basic idea of MIME is to use the ASCII format (RFC 5322), but to add structure to the message body and define encoding rules for non-ascii messages By not deviating from RFC 5322, MIME messages can be sent using the existing mail programs and protocols Widely used now 46

MIME New Headers (1) Header MIME-Version: Content-Description: Content-Id: Content-Transfer-Encoding: Content-Type: Meaning Identifies the MIME version Human readable string telling what is in the message Unique identifier How the body is wrapped for transmission Nature of the message 47

MIME New Headers (2) MIME-Version: simply tells the user agent receiving the messages that it is dealing with MIME messages and which version of MIME it uses - any message not containing a MIMEversion is assumed to an English plain-text message Content-Description: is an ASCII string telling what is in the message Content-Id: header uniquely identifies the content Content-Transfer-Encoding: tells how the body is wrapped for transmission - multiple schemes, from the the simplest - ASCII text, through to base64 encoding Content-Type: tells the type and subtype of the content 48

MIME New Headers (3) Content types and subtypes Type Subtype Description Text Plain Unformatted text Richtext Text including simple formatting commands Image Gif Still picture in GIF format Jpeg Still picture in JPEG format Audio Basic Audible sound Video Mpeg Movie in MPEG format Application octet-stream An uninterpreted byte sequence Postscript A printable document in PostScript RFC822 A MIME RFC 822(current messagerfc5322) message Message Partial Message has been split for transmission External-body Message itself must be fetched over the net Mixed Independent parts in the specified order Multipart Alternative Same message in different formats Parallel Parts must be viewed simultaneously Digest Each part is a complete RFC 822 5322 message 49

MIME Message Example (1) Date: Sat, 07 Dec 2002 16:37:32 +0800 From: Adun Gaos X-Accept-Language: zh-cn MIME-Version: 1.0 To: adungaos@celldoft.com Subject: MIME message! Content-Type: multipart/mixed; boundary="------------080202030206040206090704" This is a multi-part message in MIME format. --------------080202030206040206090704 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit This is a MIME message. Here is body. --------------080202030206040206090704 Content-Type: application/x-gtar; name="binary.tgz" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="binary.tgz" H4sIABmy8T0AA+3OsQ3CMBQEUI/iEb6dBM9jhIRogpSQgu1BQhQUiCpU7zVX3BV3vMx9uadd RYk4RKSIKG36yLcUbWrjMJQo9bmv41BTjn1vvWzrrS85p37a5nO/rt92v3oAAAAAAAAAAAD4 owef/kcgacgaaa== --------------080202030206040206090704-- 50

MIME Message Example (2) When you save the above as.eml file and open it with outlook, you can see: 51

Summary 52

Summary Email Components of email system Basic functions of email system Email address SMTP Communication procedure Model Commands and replies POP Model Commands and replies Communication procedure IMAP Comparison of POP and IMAP Message formats RFC 5322 MIME What are the limitations of SMTP? How are MIME and SSL used to offset the limitations of SMTP? 53

Useful URLs RFCs www.ietf.org SMTP, POP & IMAP http://whatismyipaddress.com/email-basics Base64 encoding and decoding online http://tools.jb51.net/tools/base64_decodegb2312.php 54

Abbreviations IMAP IMF MIME MTA POP SMTP UA Internet Message Access Protocol Internet Message Format Multipurpose Internet Mail Extension Mail Transfer Agent Post Office Protocol Simple Mail Transfer Protocol User Agent 55