Email Protocol: SMTP, POP, and MIME
✅ Paper Type: Free Essay | ✅ Subject: Computer Science |
✅ Wordcount: 2358 words | ✅ Published: 5th Apr 2018 |
Email protocol governs the interactions between email clients and servers. An Email protocol is a standard method which is used at each end of a communication channel either server side or client side, in order to transmit information properly. User is required to use a mail client to access to the mail server, by using variety of email protocols, the mail client and server can only exchange their information with each other. Three examples of Email protocol are:
- Simple Mail Transfer Protocol (SMTP)
- Post Office Protocol(POP)
- Multipurpose Internet Mail Extensions(MIME)
- Simple Mail Transfer Protocol(SMTP)
Simple Mail Transfer Protocol (SMTP) transmits electronic mail (email) within different hosts in the Department of Defense Internet protocol suite. Email servers and other mail transfer agents use SMTP to send and receive messages, while SMTP usually used by client side’s email application to send messages to the email server for relaying only. For receiving messages, client side would mostly use POP protocol which will be introduced at the next part. Examples of email client that used SMTP to send messages are webmail systems: Hotmail, Gmail and also Outlook, Microsoft Exchange and so on. SMTP listens on TCP protocol well-known port 25.
Functions of SMTP:
To enable the client side to send email message to a receiver (an email address which already exist), SMTP would perform the following functions:
- User authentication
- To verify the sender who is using SMTP server to send an email message has the right to do so.
- User notification
- After delivering the message to the destination, SMTP will check whether the message has been successfully delivered.
- If the message does not delivered successfully, SMTP notifies sender by using an error messages and the message that was not successfully delivered will be delivered back to the sender.
Advantages of SMTP:
- Simplicity
SMTP is the simplest way to send an electronic mail between various computers in a particular network. As long as there is a receiver destination and a sender who send the message, the message will be send to the destination. The message will pass through a simple process from SMTP server to an exchange server for the receiver’s computer.
- Quick Email Delivery
As we known SMTP is the simplest way to transmit a message, email messages can be sent quickly and easily by using SMTP. As long as the condition of the mail server is good, the messages that are sent will reach to the recipients as quick as possible.
- Reliability
When the message has failed to deliver, an error message will be sent to inform the sender and the message that failed to deliver will be sent back to the sender. In this case, sender doesn’t have to worry that the message send will failed to delivered, because when the message is failed to delivered, sender can choose to resend the message until the message is finally delivered to the recipient successfully.
Limitation of SMTP:
- Additional administrative overhead
Original SMTP identifies clients by using the IP addresses, but it is only available when the email services are provided by the same Internet server provider that supplied the connection. Therefore, an extension named” SMTP-AUTH” is required to verify the senders of the messages.
- Required to set up security
- Required expertise
- Post Office Protocol(POP)
Post Office Protocol (POP) is a Internet standard protocol in the application layer which allows email clients to retrieve email messages from a remote mail server. Out of the versions of POP that has been developed, current standard which used in most of the client and server email communication architecture is version 3 of POP also written as POP3. POP3 server listens on TCP protocol well-known port 110. It uses the TCP/IP protocol stack for network connection and works with SMTP for end-to-end email communication. In this case, POP is responsible to “pull” the messages from the server and SMTP will “push” the messages to the server.
Function of POP:
- Retrieve message from an ISP and whether to delete or not to delete it on the server, depends on users’ decision.
- Detect whether new message has arrived but not retrieving it from the server, meaning the messages will be stored at the server until the user choose to retrieve it from the server.
- To see whether the message is worth retrieving, POP will peek at the few sentences of the message before retrieving it.
Advantages of POP:
- Once the messages have been retrieved to the client computer, it is visible with or without the internet connection including the attachment along with the message.
- User can choose whether to delete or not to delete the messages that already retrieved from the server.
- User can choose to save a copy of some of the important messages by choosing not to delete the messages from the POP server.
Disadvantages of POP:
- Occupied a lot of hard disk spaces in computer as the email retrieved from the server are all store into the hard disk storage.
- Not accessible from other machine. Nowadays, people uses multiple devices to access to one email account, but not with POP, all messages are downloaded into one and only one PC. In order to read that specify message, user can only use the PC which used to download the messages to view it.
- Messages stored at local disk drive are vulnerable to data loss or even security threats. As those messages stored at local disk are deleted from the server and stored at only one PC at a time, it is more dangerous when the PC suffered virus attack or data corrupted.
- Multi-purpose Internet Mail Extension(MIME)
MIME is an extension which allows users to use the protocol to send different kinds of data files on the Internet, for example: audio file, image file (PNG, GIF, JPEG), video or even application programs. SMTP protocol only handled ASCII text, which means, only ASCII texts can be send through the protocol. Media type of content in email is described by MIME type, some of the examples for MIME types are:
- Plain text: txt/plain
- Java applets: application/x-java-applet
- Adobe PDF documents: application/ pdf
Advantages of MIME:
- Allows mail messages consists not only ASCII text.
Old version of Internet email standard allows only ASCII characters messages, messages not exceed 1000 characters and so on. But with MIME, it allows additional fields for mail message by using the MIME headers that describe new types of content and organization for messages.
MIME allows mail messages to consist of the following:
- Multiple objects in a single message.
- Unlimited length text messages.
- Other than ASCII characters, it also allows non-English messages.
- Message that consist multiple types of font.
- Application specify or even binary files.
- Audio, Image, Video and other multimedia attachment in the mail message.
- MIME header can help client PC to search for the suitable application software to open the attachment or file include in the mail messages.
Disadvantages of MIME:
- Some compound formats are considered as an application when they are nor for example “application/pdf”.
Diagrams below show how client and server send and retrieve messages via SMTP and POP protocols, also how the multipurpose internet mail extension works:
How to apply the following email protocols (SMTP, POP, MIME) with ASP.NET?
One way to apply the mentioned email protocols with asp.net is using System.Net namespaces. It consists of classes that provide simple programming interface for several number of network protocols, compose Email and send it, it also consist of representation of multipurpose internet mail exchange (MIME) headers. Besides, it also can access to network traffic data and peer-to-peer networking function.
SMTP
Inside System.Net, there is a namespace called System.Net.Mail, it contains classes that we needed which is to send email messages to a simple mail transfer protocol (SMTP) server for it to be delivered. Classes include in this namespaces are for example: an Attachment class which allowed user to add an attachment into the email, MailMessage class represents the email message that can be sent by using the SmtpClient class, while there is also a class which allowed user to send an email by using the SMTP.
List of all the classes in System.Net.Mail namespace will be included in Appendix A.
To actually send an email using SMTP, we will require these following items:
- The SMTP host server that we use to send email.
- A port number, which usually we use port number25.
- User name and password for authentication purpose.
- An email address of sender and recipients.
- The message content.
Once we have accessible SMTP server, it is time to send our email message! Firstly we will need to create an empty page which consists of the example coding shown:
Next we can choose to send the email to more than one person at a time, by adding email address to the “To” collection as shown below:
After that we can set the name of the sender, this will be shown along with the sender email address to the recipient once the email has been received. For instance, we can do this:
Next, we can use the CC and BCC fields in the email messages, for example:
Other than that, we can also set priority of an email message, by using one of the method provided in the System.Net.Mail class:
POP
To log in to a POP server, we need to use System.Net.Sockets namespace. Classes that we can use from the System.Net.Sockets namespace are for example TcpClient and NetworkStream.
Firstly, we will need a simple aspx page which consists of several textfields that allow user to enter the username and password.
To initiate the connection to POP3 server, we will use the System.Net.Sockets. For example, after user enter their username and password, and then there is a on click event of the button as shown in the following header:
Next, we will send the username and password to the server, and the server response will be displayed:
If the username and password are valid and successfully verified by the POP server, we will get a response and then start to retrieve a list of messages from the server. We will request for using the LIST command and display each message that we loop through:
At last, we need to close the connection to the server. In this case, QUIT command has come to use, and then server response will be display:
MIME
Similar with implementing SMTP into asp.net, we can use the classes within System.Net.Mail namespace to apply MIME into asp.net. There is one namespace called System.Net.Mime which holds the types that used to represent MIME headers. These types are use along with the types in System.Net.Mail namespace when a SmtpClient class send an email with attachment. Data of MIME is represented by Attachment class which we just mentioned in the System.Net.Mail part. Here are some example of classes included in the System.Net.Mime:
Class |
Description |
ContentType |
This represents a Content Type header in MIME protocol. |
MedisTypeNames |
Media type information for the attachment included in an email message. |
MediaTypeNames.Image |
This will specifies the type of image file attached into an email message, for example, .png, .jpeg and so on. |
For the full list of classes included in System.Net.Mime, please refer to Appendix B.
Cite This Work
To export a reference to this article please select a referencing stye below:
Related Services
View allDMCA / Removal Request
If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please: