Concept of Mail Protocols Format of an Email Addressing

A unique addressing system ,has two parts in addressing. Local part defines user mailbox and domain name mention the destination

[email protected]

Email alias:Create a group email to send email to many people like multicast. Email message fields

Here are the meanings of the fields to be filled in when you send an email:

● From: this is your ; most of the time you will not have to fill in this field, because it is generally set by the according to your preferences. ● To: This field is used for the recipient's email address. ● Subject: this is the title that your recipients will see when they want to read the email ● Cc (carbon copy): this allows an email to be send to a large number of people by writing their respective addresses separated by commas ● Bcc (blind carbon copy): This is a Cc, except that the recipient does not see the list of people in the Bcc field ● Message: This is the body of your message

Other email functions are:

● Attached Files, Attachments: A file can be attached to an email by specifying its location on the hard drive. ● Signature: If the email client allows it, you are often able to set a signature, meaning a few lines of text which will be added to the end of the document. Email Delivery Queue

Unlike ftp/http it is not necessarily to deliver email in real time.Delivery not instantaneous ,It will wait in the queue of outgoing,incoming ,intermediate MTA message queue. Component of Email system

❏ Mail Transport Agent/ (MTA) ❏ Mail User Agent (MUA)

❏ Mail Delivery Agent(MDA) MTA

The actual mail transfer is done through message transfer agents (MTAs). To send mail, a system must have the client MTA, and to receive mail, a system must have a server MTA. The formal protocol that defines the MTA client and server in the Internet is called Simple Mail Transfer Protocol (SMTP).

SMTP uses commands and responses to transfer mail between an MTA client and MTA server. SMTP Mail transfer Flow MTA connection setup MTA Connection Setup..Contd..

Sender opens TCP connection with receiver □ Once connected, receiver identifies itself □ 220 service ready □ Sender identifies itself □ HELO □ Receiver accepts sender’s identification □ 250OK □ If mail service not available, step 2 above becomes: □ 421 service not available SMTP Exchange of command response pair Message Transfer

Sender may send one or more messages to receiver □ Each message transfer has the following phases: □ One MAIL command, identifies originator •Gives reverse path to use for error reporting •Receiver returns 250 OK or appropriate fail/error message □One or more RCPT commands, identifies recipients for the message • Each recipient identified by a separate RCPT • Separate reply for each recipient (250 OK etc.) □ One DATA command transfers message text • End of message indicated by line containing just period (.) MTA connection termination MTA connection termination

Sender sends QUIT and waits for reply

□ Then initiate TCP close operation

□ Receiver initiates TCP close after sending reply to QUIT Optimization

If message is sent to multiple users on a given host,it is sent only once.

❖ Delivery to users handled by destination host

If Multiple messages are ready for given host,a single TCP connection can be used.

❖ Saves overhead of setting up and termination of connection Possible Errors

❖ Host unreachable ❖ Host out of operation ❖ TCP connection fail during transfer ❖ Faulty destination address

User error Target user address has changed Redirect if possible Inform user if not Sender re-queue the mail - will retry till a configurable period of time SMTP protocol reliability

❖ TCP connection is used to transfer mail from sender to receiver over TCP connection ❖ Attempts to provide reliable service ❖ No guarantee to recover lost messages ❖ No end-to-end ack to sender ❖ Error indication report not guaranteed SMTP receiver

❖ Accepts arriving message ❖ Places in user mailbox or copies to outbound message queue for forwarding ❖ Receiver must ● verify local mail destination ● deal with errors ❏ Transmission ❏ Lack of disk space SMTP status codes(DSN-Delivery status Notification)

Leading digits Indicates catagories 2XX-Positive Completion Reply(Successful)

3XX-Positive Intermediate Reply(Redirection)

4XX-Transient negative completion reply(Client error)

5XX-Permanent negative completion reply(Server error) SMTP status codes..Cont. POP3

Mail access protocol:

POST OFFICE PROTOCOL [RFC 1939]

Simple and limited functionality,Consists of client software and Server software, Server performs user authorization

IMAP: Internet mail access protocol [Version 4] POP3

Retrieves messages from a mail server

Typically, messages are downloaded to your mail client, and deleted from the server

Designed for use with dial-up connections when people were intermittently connected

Listens on Port 110 (with Secure POP generally on port 995) POP3 Connection Establishment POP3 protocol session root@amberit ~]# telnet mail.amberit.com.bd 110 Trying 206.71.88.102... Connected to mail.amberit.com.bd. Escape character is '^]'. +OK Dovecot ready. user [email protected] +OK pass letmein +OK Logged in. list +OK 1 messages: 1 482 . retr 1 +OK 482 octets Message Headers This is my short message quit +OK Logging out. Basic POP3 commands

USER - identifies the user □PASS - authentication for user □ STAT - lists all messages in the mailbox of user □LIST - lists the content of a message □ RETR - retrieves a particular message □ DELE - Deletes a particular message □ NOOP □ RSET □ QUIT

□ Replies □ +OK –ERR IMAP Protocol session

[root@amberit ~]# telnet mail.amberit.com.bd 143 Trying 206.71.88.102...

Connected to mail.amberit.com.bd Escape character is '^]'. * OK Dovecot ready. A1 LOGIN [email protected] letmein A1 OK Logged in. A2 SELECT Inbox * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) * IMAP Protocol session..cont.

OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. * 1 EXISTS * 0 RECENT * OK [UIDVALIDITY 1225333589] UIDs valid * OK [UIDNEXT 2] Predicted next UID A2 OK [READ-WRITE] Select completed. A3 FETCH 1 BODY[HEADER] * 1 FETCH (BODY[HEADER] {454} Message Header Delivered A3 OK Fetch completed. A4 LOGOUT * BYE Logging out A4 OK Logout completed. Connection closed by foreign host. MIME(Multipurpose Internet Mail Extensions) MIME

Main motivation SMTP can not transmit executables, images, audio/video clips, International characters (e.g. â, å, ä, è, é, ê, ë) that require 8-bit ASCII etc.

□MIME (Multipurpose Internet Mail Extensions) Allows other types of non-text data to be carried by SMTP □ Encodes image, video clip, voice data as text data to be transmitted over SMTP □ RFC 2045-2049 □Defines new header fields, standardized content formats, and encodings to transfer them over mail Email header with MIME [RFC 2045] MIME Email header

Defines five new message header fields: □MIME-Version: version no. □ Content-Type: type of data in body □Content-transfer-encoding: type of encoding used □ Content-ID: uniquely identify MIME entity □Content Description: plain text description of body MIME 1.1 Data Type and Subtype in MIME MIME content encoding BASE64 Base64 Conversion Table Quoted Printable