Presentation is loading. Please wait.

Presentation is loading. Please wait.

Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES E-mail Internet Protocols Simple Mail Transfer Protocol, SMTP RFC821 (August 1982)

Similar presentations


Presentation on theme: "Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES E-mail Internet Protocols Simple Mail Transfer Protocol, SMTP RFC821 (August 1982)"— Presentation transcript:

1 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES E-mail Internet Protocols Simple Mail Transfer Protocol, SMTP RFC821 (August 1982) Post Office Protocol, POP3 RFC 1939 (May 1996) Internet Message Access Protocol, IMAP4 First RFC concerning IMAP - 1986 year RFC 1730 (IMAP4, December 1994) RFC 3501 (new edition of IMAP4v1, March 2003) Rev. 1.04 / 11.01.2008

2 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES E-mail transport scheme MTA - Mail Transfer Agent MDA - Mail Delivery Agent Mail Client, MTA (The Bat, Outlook) SMTP server 1, MTA SMTP SMTP server 2, MTA SMTPSMTP destination server, MTA SMTP MDA Mail Client, (The Bat, Outlook) POP3 IMAP4 POP3 server IMAP server telnet User's mailboxes

3 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES E-mail protocols and OSI RM APPLICATION PRESENTATION SESSION TRANSPORT NETWORK DATA LINK PHYSICAL Layer 7 Layer 6 Layer 5 Layer 4 Layer 3 Layer 2 Layer 1 TCP IP Physical TCP/IPOSI/RM SMTP, POP3, IMAP4

4 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES SMTP features Purpose: to transfer messages across a network. In a single session multiple mail and information messages can be transmitted in either direction across the link. By default an SMTP client application will contact the remote server using TCP/IP application port number 25 as the destination port, and will select at random a port from the dynamic or private range for the source port number. SMTP provides a mechanism that allows mail to be sent directly from sender to recipient, or through intermediate hosts if there is no direct path from one to the other (DNS: MX record).

5 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES SMTP commands HELO domainidentify the client to the server ("hello, I'm...") MAIL FROM: reverse-path initiate mail transaction; arg is sender's address RCPT TO: forward- path recipient's address (issue for each recipient once) DATAfollowed by the mail message (up to CRLF.CRLF) HELP [command]ask for general help or about a specific command RSETabort current mail transaction, reply OK NOOPno-op, server responds OK QUITterminate session, server responds OK TURNchange roles: server/client; server may refuse...

6 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES SMTP replies Standard reply codes: 221(domain) Service closing transmission channel 220(domain) Service ready 250Requested mail action okay, completed 251User not local; will forward to (forward-path) 354Start mail input; end with (CRLF).(CRLF) 421(domain) Service not available, 500Syntax error, command unrecognized 501Syntax error in parameters or arguments 551User not local; please try “forward-path” 552Requested mail action aborted: exceeded storage allocation 554Transaction failed

7 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES SMTP session example S: Listen for connection on TCP port 25 C: Connect to TCP port 25 on SMTP server S: 220 mail.server.ru SMTP ready C: HELO my.domain.name S: 250 mail.server.ru C: MAIL FROM: S: 250 OK C: RCPT TO: S: 250 OK C: RCPT TO: S: 550 No such user here C: RCPT TO: S: 250 OK C: DATA S: 354 Start mail input; end with. C: Blah blah blah... C:...etc, etc, etc. C:. S: 250 OK C: QUIT S: 221 mail.server.arpa Service closing transmission channel

8 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES Mail message structure Received: from mx10.mail.ru (mx10.mail.ru [194.67.57.20]) (5) by dfe3300.karelia.ru (8.9.0/8.9.0) with ESMTP id JAA02601 for ; Thu, 18 Apr 2002 09:19:13 +0400 Received: from f5.int ([10.0.0.57] helo=f5.mail.ru) (4) by mx10.mail.ru with esmtp (Exim MX.A) id 16y46p-0002ox-00 for somebody@dfe3300.karelia.ru; Thu, 18 Apr 2002 09:05:27 +0400 Received: from mail by f5.mail.ru with local (Exim FE.5) (3) id 16y46o-000CfY-00 for somebody@dfe3300.karelia.ru; Thu, 18 Apr 2002 09:05:26 +0400 Received: from [213.59.200.7] by win.mail.ru with HTTP; (2) Thu, 18 Apr 2002 09:05:26 +0400 From: "Testing" To: somebody@dfe3300.karelia.ru Subject: For testing purposes only Mime-Version: 1.0 X-Mailer: mPOP Web-Mail 2.19 X-Originating-IP: [213.59.200.7] (1) Date: Thu, 18 Apr 2002 09:05:26 +0400 Reply-To: "Testing" Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit Message-Id: X-UIDL: 74fb663e2be8352b3a0b88ca08030c1e Тестовое сообщение. BLUE text was created by originating mail agent (mail client). 4 headers (Received:) were added on each SMTP interaction (hop) (2-5).

9 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES CC: and BCC: headers CC - carbon copy BCC - "blind" carbon copy When sending mail message through BCC mechanism to multiple recipients, they do not know about the fact of spam. MTA cuts out string from message body and then sends multiple distinct letters using RCPT command.

10 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES POP3 features Purpose: to retrieve mail from server. Dedicated client and server hosts. POP3 service is mapped to TCP port 110. When the TCP connection is established, the POP3 server sends a greeting. The client and POP3 server then exchange commands and responses (respectively) until the connection is closed or aborted. Multistring reply must end by.

11 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES POP3 commands USER namestring identifying a mailbox (required) PASS passwda server/mailbox-specific password (required) APOP name MD5digest a string identifying a mailbox and a MD5 digest string (both required) STATinquire the content of mailbox (reply: +OK 2 320 -- 2 messages of overall volume of 320 octets) LIST [msg]list [all] messages RETR msgretrieve the certain message DELE msgdelete the certain message RSETreset all previous prepared actions, reply +OK NOOPno-op, server responds +OK QUITterminate session...

12 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES POP3 session example S: C: S: +OK POP3 server ready C: APOP mrose c4c9334bac560ecc979e58001b3e22fb S: +OK mrose's maildrop has 2 messages (320 octets) C: LIST S: +OK 2 messages (320 octets) S: 1 120 S: 2 200 S:. C: RETR 1 S: +OK 120 octets S: S:. C: DELE 1 S: +OK message 1 deleted C: RETR 2 S: +OK 200 octets S: S:. C: DELE 2 S: +OK message 2 deleted C: QUIT S: +OK dewey POP3 server signing off (maildrop empty) C: S:

13 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP vs POP3 POP3: all messages are downloaded to the client and then deleted from server. IMAP: accesses remote mail-boxes as if they were present on the local machine. The IMAP4 client can request any part of the message, such as the envelope or the headers and download the whole message only when needed. Server based searching is also supported. Messages are not deleted immediately, rather they are marked for deletion and only removed once the client logs off or sends the expunge command. POP3: useful for people working with one computer. IMAP: Because the messages are stored on the server, it doesn't really matter who or where the client is (synchronization).

14 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 description Purpose: to allows a client to access and manipulate electronic mail messages on a server. Messages in IMAP4rev1 are accessed by the use of numbers. These numbers are either message sequence numbers or unique identifiers. The IMAP4rev1 protocol assumes a reliable data stream such as that provided by TCP. When TCP is used (!), an IMAP4rev1 server listens on port 143. The client command begins an operation. Each client command is prefixed with an identifier (typically a short alphanumeric string, e.g., A0001, A0002, etc.) called a "tag". A different tag is generated by the client for each command. Client need not wait for reply on certain command, it can issue next command to execute

15 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 session states Transport connection and server greeting Non-authenticated Authenticated (operations involving mailboxes) Selected (operations involving messages) Logout, break or close connection greeting/bye greeting/ PREAUTH greeting/OK LOGIN successful SELECT / EXAMINE

16 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 description cont'd Unique Identifier (UID) (32 bit, greater than previous) Message Sequence Number (position of message in mailbox, can be reassigned during the session) Internal date Size Envelope structure (parsed headers part) Body structure (parsed structure of MIME content) Flags: 1.\SeenMessage has been read 2.\AnsweredMessage has been answered 3.\FlaggedMessage is "flagged" for urgent/special attention 4.\DeletedMessage is "deleted" for removal by later EXPUNGE 5.\Draft Message is marked as a draft. 6.\RecentMessage is "recently" arrived in this mailbox (only for 1st read-write session). Message attributes:

17 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 client commands CAPABILITY: requests a listing of capabilities that the server supports (valid in any state). Example: C: a001 CAPABILITY S: * CAPABILITY IMAP4rev1 STARTTLS AUTH=GSSAPI LOGINDISABLED S: a001 OK CAPABILITY completed C: a002 STARTTLS S: a002 OK STARTLS completed C: a003 CAPABILITY S: * CAPABILITY IMAP4rev1 AUTH=GSSAPI AUTH=PLAIN S: a003 OK CAPABILITY completed C: a004 LOGIN joe password S: a004 OK LOGIN completed Server made client to establish TLS connection. Note: strings beginning with * correspond to the reply with the following tag number.

18 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 client commands SELECT: selects a mailbox so that messages in the mailbox can be accessed (valid in Authenticated State). Example: C: A142 SELECT INBOX S: * 172 EXISTS S: * 1 RECENT S: * OK [UNSEEN 12] Message 12 is first unseen S: * OK [UIDVALIDITY 3857529045] UIDs valid (session ID) S: * OK [UIDNEXT 4392] Predicted next UID S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited S: A142 OK [READ-WRITE] SELECT completed EXAMINE: the same as SELECT but the selected mailbox is identified as read-only.

19 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 client commands CREATE: creates a mailbox with the given name (valid in Authenticated State). Example: C: A003 CREATE mailbox2/ S: A003 OK CREATE completed DELETE: deletes a mailbox with the given name (valid in Authenticated State). Example: C: A104 DELETE mailbox2/ S: A104 OK DELETE completed

20 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 client commands Selected State CLOSE: removes all messages that have the \Deleted flag set from the currently selected mailbox, and returns to the authenticated state from the selected state. EXPUNGE: removes all messages that have the \Deleted flag set from the currently selected mailbox. SEARCH: searches the mailbox for messages that match the given searching criteria. Example: C: A282 SEARCH FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith" S: * SEARCH 2 84 882

21 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 client commands Selected State FETCH: retrieves data associated with a message in the mailbox. STORE: alters data associated with a message in the mailbox. COPY: copies selected messages to the end of the specified destination mailbox.

22 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 session example S: * OK IMAP4rev1 Service Ready C: a001 login mrc secret S: a001 OK LOGIN completed C: a002 select inbox S: * 18 EXISTS S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) S: * 2 RECENT S: * OK [UNSEEN 17] Message 17 is the first unseen message S: * OK [UIDVALIDITY 3857529045] UIDs valid S: a002 OK [READ-WRITE] SELECT completed C: a003 fetch 12 full S: * 12 FETCH (FLAGS (\Seen) INTERNALDATE "17-Jul-1996 02:44:25 -0700" RFC822.SIZE 4286 ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)" "IMAP4rev1 WG mtg summary and minutes" (("Terry Gray" NIL "gray" "cac.washington.edu")) ((NIL NIL "imap" "cac.washington.edu")) ((NIL NIL "minutes" "CNRI.Reston.VA.US") ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL " ") BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 92)) S: a003 OK FETCH completed

23 Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES IMAP4v1 session example C: a004 fetch 12 body[header] S: * 12 FETCH (BODY[HEADER] {342} S: Date: Wed, 17 Jul 1996 02:23:25 -0700 (PDT) S: From: Terry Gray S: Subject: IMAP4rev1 WG mtg summary and minutes S: To: imap@cac.washington.edu S: cc: minutes@CNRI.Reston.VA.US, John Klensin S: Message-Id: S: MIME-Version: 1.0 S: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII S: S: ) S: a004 OK FETCH completed C: a005 store 12 +flags \deleted S: * 12 FETCH (FLAGS (\Seen \Deleted)) S: a005 OK +FLAGS completed C: a006 logout S: * BYE IMAP4rev1 server terminating connection S: a006 OK LOGOUT completed As a result, message number 12 was deleted from mailbox.


Download ppt "Petrozavodsk State University, Alex Moschevikin, 2003NET TECHNOLOGIES E-mail Internet Protocols Simple Mail Transfer Protocol, SMTP RFC821 (August 1982)"

Similar presentations


Ads by Google