LPI 101-500 – 108.3: Basics of Mail Transfer Agents (MTA)
- sendmail, postfix, mailq
Before we go into practice, we must first discuss three terms so that you understand the relationships a little better. This chapter deals exclusively with the socalled mta, but I have to mention the other services too. The transmission of emails is usually done by three programs. First we have the mua, then the mda and the mta. mua stands for mail user agent. A male user Agent is an email client program that each of us probably works with on a daily basis, or at least has worked before. That would be programs like Outlook or thunderbird or kmail or Evolution. mda stands for Mail Delivery Agent. The Mail Delivery Agent is responsible for managing emails on a server.
The nda checks whether an incoming email to a certain recipient can be delivered locally to its recipient, or whether it has to be forward elsewhere. In the latter case, this message would be forwarded to the mta. Well known mdas are, for example, mail drop cyrus or protein. mta stands for Mail Transfer Agent. This mail Transfer Agent accepts the emails and forwards them to the correct target server. The smtp protocol is usually used here. If the email has been forwarded to the correct target server, the mda takes over again and forwards it to the corresponding mail directory, which the user can then access with his mua and receive this email.
Well known mtas are post six. Send mail or exit. By default, neither an mda nor an mta is installed on my ubuntu. This is also not necessary on a notebook or a computer for home use because most of us will not use the local email address, but our emails from an email service such as gmx, gmail or similar providers. These of course then take on the corresponding tasks. It is not necessary to configure and use an mta or an mda for the Epic One exam. This is part of the Epic Two exam, which is why we want to limit ourselves to the theory at this point, because unfortunately it is not that easy to show it in practice without having too much content that we don’t need for the exam.
Nevertheless, I think it’s okay to install the two mta, post, fix, and send mail here. So as always with pseudo apt install and then first let’s install Sendmail and then Postfix. And here we have a little graphic configuration tool. It’s not important what we are using here because it will definitely not work after this or in this lesson. I only want to show you some files, so I would use Local only and that’s it. That’s the configuration. If you use a linux server as a mail server and have installed an mda or mta accordingly, the file at C aliases will also exist. This file is used to redirect emails, so let’s take a look at this file. We have to use pseudo because otherwise we are not able to store something in this file.
pseudo pi XY aliases and I have prepared these two lines here so this is the standard method for forwarding emails. We can see the emails that addressed to Tommy are assigned to the Thomas user account and since Thomas is also the administrator root of the server, he also receives emails address to root. Another interesting entry would be something like that so we are referring to file our employees. The names of the employees are in this file. So if an email is sent to employees, it will be forwarded to every employee who can be found in this file here. It is important to know that as soon as you have created such an alias in the atc alias file, this must be made known to the mta.
So for example, San May Sandmay will not notice this on its own. There are two different waves here once the command new aliases and the new alias then can be used immediately by Sendmail. The other option for Sendmail would be the following command sendmail bi so both possibilities lead to the same result the etsy aliases file can of course only be written by root. A standard user can still set up forwarding independently for example to his vacation replacement. To do this, the user must create a file called forward in his home directory so dot forward the dot is very important here and this file actually simply contains the mail address to which the mail should be forwarded, nothing else.
So let’s create a file like this so VI and then in our home directory forward and then for example, test@gmx. com and that is actually all, it is not more. The forwarding is also active immediately and does not have to be activated with an extra command even if the chapter description of lpi says that other configuration files are not covered. I would like to briefly explain where the configuration files of the two important mta send mail and Post fix are located. The main Sendmail configuration file is sendmail CF this file is located in the atsee mail directory or the main postfix configuration file is the main dot CF and this is located in the etsy post fix directory.
But we don’t want to go any deeper because as I said, it is not necessary for the exam. Maybe it’s a little bit easier when I show you these two files here so the first file is located, as I said, in at the mail and then it is the file it is the Sandmay CF file. We don’t have to look inside this file. It is only important that you know. The main configuration file of send mail is located in at cmail and the name of the file is sendmail CF shortly. The main configuration file of post fix it is located at the post fix and here we have the main CF. This is the main configuration file of postfix, which is stored in at sea. Post fix. Okay, what we should definitely know are some important files and directories, on the subject of mail.
In VAR spool mail there are files with the names of the relevant users who receive mail on this linux system. So CD VAR spool mail sorry bar spool mail and in my case nothing is stored here. But of course that is also clear because I’ve not configured an mda or mta here the print queue or the mail queue is located in the directory. I don’t have this directory here. I think it’s because it is post fixed and send mail are not configured. So this directory is missing. But normally we have this one with this name bar spool MQ and in MQ there are the messages that are picked up by the mda, which then either forwards them locally or forwards them to the mta for forwarding.
In order to be able to see the content of this queue, it is not necessary to change this directory or to change into this directory. There is a command for this. This is called mayq called without parameters and make you shows the current may queue. So the command is mail queue is empty. So this command does not work either because postfax is not configured postfix and same way is not configured and our mail queue is empty. But as I said, api expressly writes on the subject that configuration or reading configuration files is not part of the test, so we don’t have to configure it.
Now to perform the command correctly. The only important thing for the exam is that you know what the command is called when you are asked for it. The directory structure of post fix can be found in cdvar spool and then postfix. The etsy may directory contains most of the configuration files for sendmail. Other mtas are exim or qmail. For the test it is important to be able to name some mtas. So mtas are exim, qmail, sendmail and postfix. As already mentioned, knowledge of the configuration is not required. This becomes a topic in the Epic II exam.