Simple Mail Transfer Protocol (SMTP) Lecture 4. SMTP, TELNET, and FTP Objective: to know the underlying principles of Simple Mail Transfer Protocol (SMTP) Telnet (a remote log in) protocol File Transfer Protocol Simple Mail Transfer Protocol (SMTP) SMTP defines a mechanism for electronic mail based on TCP/IP. It supports Sending a single message to one or more recipients identified by email address. Sending messages that include text, voice, video, ore graphics. Sending message outside the Internet. SMTP mechanism A human user uses a user agent (UA) to prepare the message contains header and body Creating the envelope containing the sender’s address, receiver’s address, and other information
The user agent periodically checks the mailbox. The Message Transfer Agent (MTA) transfers the mail across the Internet, from MTA client to MTA server. The user agent periodically checks the mailbox. mailboxes spool Alias exp. database UA Interface MTA Client MTA Server User A User B TCP/IP/Data Link
Email address local part@domain name The local part define the name of a mailbox, a file storing all incoming mail for a user, can be retrieved by the UA. The domain name is the domain name of the MTA server. Delay: stored in a spool on either side, intermediate delay. Aliases: one-to-many, many-to-one SMTP uses commands and responses to transfer messages between an MTA client and an MTA server
Commands by MTA client HELLO:hfan.wlu.ca MAIL FROM: hfan@wlu.ca RCTP TO: hfan@wlu.ca DATA followed by the actual data QUIT, RESET, HELP, VRFY, NOOP, SEND FROM, etc. Responses by MTA server A three-digit code: 214 Help message, 220 Service ready, 221 Close channel 250 OK 354 Start mail input, 421 Service is not available 450 Mail box is not available, etc. Mail transfer phases: Steps: 1. connection establishment, MTA Client (MC) makes a TCP connection to port 25 MTA sever (MS) responses 220 (service ready), MC: send command HELLO:hfan.wlu.ca, MS responses 250 (OK).
Step 2. mail transfer: after connection between MTA client and MTA server. An eight step message transfer is connected. MC: MAIL FROM:hfan@wlu.ca MS: 250 MC: RCPT TO:master@wlu.ca MS: 250 MC: DATA MS: 354 MC: From: To: Date: Subject: space line ….. Dear: the contents of the email . MS: 250 Step 3. connection termination MC: QUIT MS: 221 Multipurpose Internet Mail Extension (MIME) is an extension of SMTP that allow the transfer of multimedia message.
Mail access protocols POP (Post Office Protocol) The client open opens a connection with server on TCP port 110. It then sends its user name and password to access the mailbox. POP client (PC) communicates with POP server (PS) UC: user name PS: OK UC: password PS: OK UC: list PS: the number of emails and their sizes PC: retrieve 1 PS: email 1 ………….. PC: retrieve N PS: email N IMAP 1. Client can check the email header 2. Search the email for a special string 3. Partially download an email 4. Can create, delete or rename mailbox on server side 5. Can create a hierarchy of mailbox.
TCP IP Data link Physical TELNET Define a mechanism for users to log on to a remote machine using TCP/IP. TELNET uses one TCP connection. Server uses port 23 and client uses an ephemeral port. The same connection is used for both control commands and data. This is accomplished by embedding the control characters in a data stream. A terminal driver interprets the keystrokes on the local terminal or terminal emulator. Terminal driver TCP IP Data link Physical Telnet client Terminal Telnet server Application programs Internet OS NVT character set Local character set Remote character set
Control Characters Telnet use the Network Virtual Terminal (NVT) system to encode characters on the local system. On the server machine, NVT decodes the characters to a form acceptable to the remote machine. NVT uses an 8-bit character set in which the highest order bit is set to be one. EOF = 236 = 111011100 end of file EOR = 239 end of record IAC = 255 = Interpreted as Control, etc. A set of characters for remote control, control characters are embedded in the data stream and preceded by the interpreter IAC. Options Binary, echo, suppress go-head, status, timing mark, terminal type, terminal speed, line mode
File Transfer Protocol (FTP) FTP defines a mechanism for copying a file from one host to another using TCP/IP FTP requires two connections for data transfer A control connection on port 21 (server side) A data connection on port 20 (server side) Control 1. The server issues a passive open 2. The client uses a ephemeral port and issues an active open Data connection: 1. The client issues a passive open using ephemeral port. 2. Client sends this port number to the server using PORT command, 3. the server receives the port number and issues an active open using the port 20. Communication over control connection uses NVT ASCII. File type: ASCII, Binary. Trans. Mode: stream, block, and compressed mode.
Prior to the actual transfer of files, the file type, data structure, and transmission mode are defined by the client through control connection. There are six classes of commands sent by the client to establish communication with the sever: 1. Access commands: USER, PASS, ACCT, QUIT, etc 2. File management commands: CWD ( directory name, DELE (file name), RNTO (rename), etc. 3. Data formatting commands, 4. port defining commands, 5. file transfer commands, 6. Mis. Commands. Responses are sent from the server to the client during connection establishment. Three digits code. There are three types of file transfer A file is copied from server to client A file is copied from client to sever A list of directories or filenames is sent from server to client.