Chances are, most of you reading this guide are already familiar with the most commonly used communication technology. But have you ever wondered how it works? In this article, we will learn how this service works and what is POP3, SMTP, IMAP and which type of server would support the SMTP.
Mail Server Assignment
Methods for fast message transmission began to be developed back in the early 60s of the XX century, and over the past time, certain standards have been developed in this direction and a list of functionality has been defined. The main function of mail servers is to instantly send information to an addressee anywhere in the world using special protocols, which in this case means the method and features of data transfer.
The following mail protocols exist:
- SMTP – sends a letter from a computer to a mail server and between the same servers;
- POP3 – receives and forwards mail to the recipient in the local application (MS Outlook, Thunderbird);
- IMAP – also accepts, but directly in the WEB environment (standard interface Gmail in the browser).
Regardless of what mail servers are, they all have several comparable characteristics:
- mailbox name and domain;
- gateway bandwidth and dedicated mail storage space;
- the ability to customize the mailing list;
- belonging to a particular organization.
Modern mail servers can serve any type of domain and the speed of connection to the mail server and delivery depends on the size of the letter.
Regardless of the type and capabilities, they all serve the same purpose – to carry out written communication in the information environment quickly and in the most convenient way.
What Is POP3?
POP3 is a protocol for receiving electronic messages. To view mail, letters are downloaded to the recipient’s computer. After that, they can be deleted from the server. All actions with incoming mail occur on the user’s computer.
This protocol has undeniable advantages:
- there is always access to letters stored on a computer (even when there is no possibility of accessing the Internet);
- the attachment opens with the message, which is very convenient;
- mailbox space is constantly freed up by reloading emails to the computer’s hard drive.
The POP3 protocol runs on the standard TCL/IP network port 110 if no encryption is required. If encryption (TLS or SSL) is required, port 995 is used.
The disadvantage of the POP3 protocol is the risk of infecting the local computer with viruses that came with the mail, and the inconvenience of simultaneously working with mail on several devices. It can also be tiring to have to back up information frequently. Since the information is only on the hard disk, its failure threatens the irretrievable loss of all messages.
POP3 is an old protocol created in 1988. Its capabilities are no longer enough for the comfortable use of e-mail. It was replaced by the IMAP protocol.
Differences Between POP3 and IMAP?
IMAP (application layer protocol for accessing email), as well as POP3, is used to receive email messages to a local client, however, it has a significant difference – only the headers of email messages are downloaded, the body of the letter itself remains on the server. This communication protocol works in two directions, if changes occur on the local client, they are transmitted to the server. Recently, IMAP has become more popular as email giants like Gmail recommend using it instead of POP3.
The default IMAP ports are:
- Port 143 – non-encrypted port
- Port 993 – SSL/TLS port, also known as IMAPS
SMTP Mail Delivery
In order for mail to reach its destination, the SMTP protocol must be able to deliver it, firstly, to the correct host and, secondly, to the correct user on this host.
SMTP then resolves the host address using a domain name server (DNS) or a local host table. The hostname is in the user’s email account (mycompany.com); the IP address is used by SMTP to determine the mail server to send mail to (188.8.131.52).
When the SMTP server looks up hostname addresses in the local host’s table, IPv6 addresses are ignored.
If any of the configured DNS servers have IPv6 addresses, then all DNS servers must support the recursion feature to resolve email domains for which those configured servers are considered unauthorized.
The interaction between DNS and SMTP is described in the following sections:
- Setting up a DNS domain
- Mail Gateway and MX Records
When receiving incoming mail, the SMTP server first translates the destination hostname into an IP address. Because of the ability to create aliases, a server can have multiple hostnames. The SMTP server uses the socket interface to determine if this IP address belongs to the localhost.
How SMTP Mail Is Sent
The email protocol performs the function of a relay, that is, a transmitter. Each has a unique address, which makes it possible to find the recipient when forwarding.
The SMTP protocol accompanies the execution of several commands in the form of a sequence of requests and responses.
The main parameters that SMTP commands send:
- MAIL FROM – sender’s address,
- RCPT TO – recipient,
- DATA – header and body.
SMTP server is a kind of postman. His task is to pick up the “package” from one user, find the optimal and accurate way of transportation and give it to another user.
Conditionally divided into:
- Ordinary. For personal correspondence. More often they belong to providers of web hosting, internet networks, etc. But the peculiarity is that the amount of mailings is limited, usually for a day.
- Special repeaters. This is a server for bulk and transactional email campaigns. The limit ends at millions. You can not be afraid that the IP will be blocked.
Where and how can I set up an SMTP connection? To work through an SMTP connection, you can configure the server yourself or use a machine with ready-made settings. You can use the following basic options:
- Order from an ISP. In this case, you do not have to configure the server yourself. However, you may experience limits on the speed and number of emails sent. Before choosing this option, check the terms of the contract or contact the support service.
- Set up hosting. If you have a website, it is enough to set up a hosting provider’s server for messaging. For example, you can set up mail on REG.RU hosting. In this case, you will not have restrictions on the number or speed. At the same time, it should be borne in mind that your domain can be blocked at any time based on a complaint from users. This will affect the reputation of the entire site.
- Order on commercial service. This option is suitable if you plan regular mailings on a large scale. The use of special services increases the chance that letters will end up not in Spam, but Inbox. Most often, services offer several options for tariffs. To choose the best, calculate the approximate number of letters that you plan to send monthly.
- Set up in a free service. The ability to send letters via SMTP is provided in any modern mail service. Just like in the case of hosting, free services have limits on the number of emails sent. To effectively use this option, you can create several accounts and set up a distributed mailing list.
- Set up in a virtual environment. This option is ideal for mass mailings. At the same time, it has significant drawbacks. To use a virtual environment, it must be properly configured. This will require costs – financial (if you decide to call a specialist) or time (if you decide to figure out the settings yourself). You will also need a dedicated IP address.
Advanced SMTP Protocol
Since its inception in 1982, the SMTP protocol has done an excellent job of sending messages between computers on the Internet. However, over time, the limitations laid down in the protocol became noticeable. Then, instead of replacing the standard protocol, which was widely used by that time, it was decided to improve some of the functions of the SMTP protocol. At the same time, a decision was made, leaving all the SMTP specifications in their original form, only adding new features to them.
In 1995, RFC 1869 saw the light of day, which defined a method for extending the capabilities of the SMTP protocol called “Extended SMTP Services”.
Extended SMTP (Extended SMTP) is implemented as follows. At the beginning of an SMTP session, the HELO command is replaced by the invitation command, EHLO. The receipt by the SMTP server of such a command means that the client can send extended SMTP commands to it.
The TURN command has already been mentioned before. This command is quite effective, but unfortunately not safe. To compensate for this shortcoming, RFC 1985 defines a new implementation of the TURN command that provides greater security. The ETRN command allows an SMTP client to issue a request to an SMTP server in order to initiate another SMTP connection with the client in order to send messages to it. The only difference between ETRN and TURN is that the request is not to use an existing connection, but to open a new SMTP session. Thus, the SMTP server can connect to the client computer using the normal DNS name resolution algorithms. In this case, the opening of a new connection is not based on the name under which the client computer is registered on the server, but on the real hostname of the client. In this case, if a hacker establishes an unauthorized SMTP connection and uses the ETRN command, the SMTP server will simply establish a new connection with the real client and forward the email to him. As a result, there were no casualties. The format of the ETRN command is as follows:
1. ETRN name
Here, the role of the name can be either a hostname or a domain name (if a request is received to receive mail for the entire domain). The ETRN team is a very good help for the email administrator. If the mail for your mail server is stored by the Internet provider, then using this command you can notify him that he is ready to receive mail collected for you. There are several ways to implement such an algorithm. One is to use the special Perl program that comes with the Sendmail program. Its job is precisely that after establishing a connection with the ISP, it issues the ETRN command with your domain name as an argument. Upon receiving this command, the ISP’s SMTP server initiates another SMTP connection to your local SMTP server (over the same PPP connection) and delivers all the mail destined for your domain that it has in its queue for sending.
Which Companies Need a Mail Server?
Having an idea of what a mail server is and what it is for, you can already conclude whether your company needs it. First of all, it is important to determine what role mail plays in your workflows, estimate the expected load on the mail, as well as how much money and time you can spend on the project.
It is worth paying attention to the number of employees of the company. For example, for a small team of 10-20 people, we recommend creating mail on a domain, and placing it on the servers of mail service or hosting. Why not standard mail? Because an email address with a unique domain has a positive effect on the reputation of the company, is more trustworthy and easier to remember. It also allows the manager to keep the work of departments under control. Among the types of corporate mail, the mail server is more suitable for medium and large organizations.
To succeed in this task, you will need a team of professionals. How to hire world-class engineers isn’t a hard question anymore due to the online engineering marketplaces. But anyway you have to understand that even the highest software developer salary could be the cheapest investment in your business. And this investment will be one of the most significant.