E-mail: SMTP, POP, IMAP Email
Transcript
E-mail: SMTP, POP, IMAP Email
Email outgoing message queue user mailbox Tre componenti: E-mail: SMTP, POP, IMAP 1 E-Mail: mail server Mail Server mailbox contiene i msg non ancora letti degli utenti message coda dei msg da inviare Smtp: protocollo di comunicazione tra i mail server SMTP SMTP mail server user agent SMTP user agent mail server User Agent Funzionalità: per leggere, editare ed inviare mail Eudora, Outlook, Pine, MacMail Messaggi sono memorizzati nel server mail server SMTP SMTP mail server user agent user agent mail server SMTP user agent user agent user agent 2 E-Mail: smtp [RFC 821] user agent mail server user agent mail server simple mail transfer protocol: smtp user agent user agent user agent user agent 3 Basato su tcp per avere un trasferimento affifdabile delle mail, la porta 25 è la porta di default Trasferimento diretto tra i server coinvolti effettuato in tre passi denominati: handshaking (greeting) transfer closure Modalità di interazione: command/response command: testo in formato ASCII response: status code e testo Messaggi sono codificati in 7-bit ASCII 4 1 Scenario: Alice e Bob 4) SMTP (lato cliente) trasmette il messaggio di Alice sulla connessione TCP 5) Il mailserver di Bob memorizza il messaggio nella mailbox di Bob 6) Bob legge il messaggio tramite il suo user agent 1) Alice invia una e-mail a [email protected] 2) Messsaggio è inserito nella coda del mail server 3) SMTP (lato cliente) apre una connessione TCP con il mail server di Bob 1 user agent 2 mail server 3 mail server 4 5 6 Esempio di interazione smtp S: C: S: C: S: C: S: C: S: C: C: C: S: C: S: user agent 220 hamburger.edu HELO crepes.fr 250 Hello crepes.fr, pleased to meet you MAIL FROM: <[email protected]> 250 [email protected]... Sender ok RCPT TO: <[email protected]> 250 [email protected] ... Recipient ok DATA 354 Enter mail, end with "." on a line by itself Do you like ketchup? How about pickles? . 250 Message accepted for delivery QUIT 221 hamburger.edu closing connection 5 Piccole esercitazione: 6 smtp utilizza connessioni persistenti Smtp: formato dei messaggi (header & body) in 7-bit ascii Caratteri non permessi (e.g., CRLF.CRLF). Codifica dei messaggi (in base-64 o quoted printable) smtp server: utilizza CRLF.CRLF per indicare la fine del msg telnet server_di_posta 25 220 reply from server Digitare i comandi HELO, MAIL FROM, RCPT TO, DATA, QUIT 7 smtp Smtp vs http http: pull email: push Interazione ASCII: command/response + status codes http: ogni oggetto è incapsulato nella risposta smtp: multipart message con oggetti multipli (eg attachment)8 2 Mail: formato dei messaggi header smtp: RFC 822: header lines To: From: Subject: Non sono i comandi smtp! blank line MIME: multimedia extensions MIME: multimedia mail extension, RFC 2045, 2056 Campi addizionali presenti per la dichiarazione dei MIME content type MIME version body Metodo di codifica Dati multimediali type, subtype, parameter body Dati codificati Solo formato ASCII From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data ..... ......................... ......base64 encoded data 9 MIME types Content-Type: type/subtype; parameters Text subtypes: plain, html Image subtypes: jpeg, gif Audio subtypes: basic (8-bit coding), 32kadpcm (32 kbps coding) Video 10 Multipart Type Message From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=98766789 --98766789 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain subtypes: mpeg, quicktime Dear Bob, Please find a picture of a crepe. --98766789 Content-Transfer-Encoding: base64 Content-Type: image/jpeg Applications Invocate per rendere “viewable” questi tipi subtypes: msword, octet-stream base64 encoded data ..... ......................... ......base64 encoded data --98766789-- 11 12 3 E-Mail: protocolli di accesso user agent SMTP SMTP mail server POP3 or IMAP POP3 client: user: username pass: password Server: +OK -ERR user agent mail server Mail access protocol: POP: Post Office Protocol [RFC 1939] authorization (agent <-->server) and download IMAP: Internet Mail Access Protocol [RFC 1730] Maggiori funzionalità Manipolazione dei msgs memorizzati nel server HTTP: Hotmail , Yahoo! Mail, etc. transaction phase, 13 client: list: list (message numbers) retr: retrieve message dele: delete quit POP3 vs IMAP POP3 Standard: modalità “download and delete”. L’utente non puo’ leggere nuovamente I msg se cambia il mail reader Modalità “Downloadand-keep”: copie dei msg su clienti diversi POP3 è un protocollo stateless S: C: S: C: S: authorization phase IMAP I msg sono sempre sul server Utente puo’ organizzare I msg in folder IMAP è un protocollo con stato (eg nomi dei folder, filtri) on list 1 498 2 912 . retr 1 <message 1 contents> . dele 1 retr 2 <message 1 contents> . dele 2 quit +OK POP3 server signing off 14 ftp: file transfer protocol user 15 C: S: S: S: C: S: S: C: C: S: S: C: C: S: +OK POP3 server ready user alice +OK pass hungry +OK user successfully logged FTP FTP user client interface File system locale file transfer FTP server Sistema remoto Funzionalità: trasferimento di dati (files) da/per il sistema remoto Architettura software: client/server client: il sistema che attiva il trasferimento server: il sistema remoto ftp: RFC 959 ftp server: port 21 16 4 FTP FTP è un protocollo definito già nella struttura di ARPANET Modalità di interazione Interactive Mode Batch Mode 17 Il client ftp si connette al server ftp sulla porta 21, indicando TCP come protocollo di trasporto Effetto: vengono aperte due connessioni TCP parallele: control: scambio dei comandi e delle risposte tra client e server. data: trasferimento effettivo dei dati ftp: protocollo con stato Il server conserva informazioni di stato: la directory corrente, informazione per la autenticazione dell’utente. ftp: controllo e dati TCP control connection port 21 FTP client TCP data connection port 20 FTP server 18 ftp commands, ftp responses Commands: Return codes Inviati in formato ASCII sul canale di controllo USER username PASS password Codici di stato 331 Username OK, password required 125 data connection already open; transfer starting 425 Can’t open data connection 452 Error writing file LIST restituisce la lista dei file presenti nella directory corrente RETR(get) filename STOR (put) filename 19 5