How does email work?

The overall picture looks like this:
Is the mail transfer agent (MTA), he is responsible for the exchange of mail between mail servers (among other MTA?)
MUA is the agent responsible for delivery to the end user.

Here is a detailed diagram from Wikipedia:650px-MTA-MDA-MUA_relationship.svg.png
The caption of the image:
(spoiler)
MTA (eng. Mail Transfer Agent — mail transport agent) that takes care of transferring mail between mail servers; typically, the first MTA in the chain receives the message from the MUA, the latter sends a message to MDA; a possible implementation of sending mail through a smart host.
MDA (eng. Mail Delivery Agent — mail delivery agent) is responsible for mail delivery to the end user.
MUA (eng. Mail user agent — mail user agent; in Russian notation, there is a term e-mail client) is a program providing a user interface that displays the received email and providing the opportunity to meet, create, redirect messages.


Explain to me how this scheme is sending mail. when I'm with mail.ru write on gmail?
What will be the MTU that will be the MUA, where it stores all the received emails?
June 14th 19 at 20:29
4 answers
June 14th 19 at 20:31
Take two mail providers: mail.ru and gmail.com.
They have registered two users respectively: А@mail.ru and Б@gmail.com
To And successfully sent a letter to the recipient B, and he accepted it, the following happens.

The scheme is quite simple:

The sender А@mail.ru send a letter to the recipient Б@gmail.com

Server mail.ru (MTA), get a job with a mail mediator MUA (client's email program (The Bat, Mozilla Thunderbird)) SMTP mail server looking for gmail.com (MTA) for the domain part of the address (in our case gmail.com) via DNS. SMTP server mail.ru looks in DNS for the domain gmail.com MX record (mail exchange), and it indicates the MTA server recipient Б@gmail.com (in the simple case).
Further, MTA mail.ru associated with the MTA gmail.com SMTP is a series of checks from both servers if it is successful, the email is transmitted to the mail server queue gmail.com.
Then MTA gmail.com delivers the mail to the incoming mail server (called the MDA, that is, the agent e-mail delivery), which stores the email in the mailbox of the user Б@gmail.com in anticipation of its acceptance by the user. Then with the help of MUA (client's email program (The Bat, Mozilla Thunderbird)) user Б@gmail.com MDA extracts the email using POP or IMAP.
As a MUA may be a web interface used to interact with the incoming mail server (MDA) and the outgoing mail server (MTA).
hqdefault.jpg - xzavier10 commented on June 14th 19 at 20:34
June 14th 19 at 20:33
This is the wrong scheme, respectively, above her incorrect comments.

Mail transfer agent (MTA) is used to exchange mail between servers, MDA (mail delivery agent) for local delivery letters in the mailbox, and the MTA and MDA are working on the mail servers. MTA and MDA can be parts of a single email program (most of the MTA in varying degrees, support local delivery), and can have different applications. But to the computer of the user, neither the MTA nor the MDA are not related, they work on the mail server. MUA is used to retrieve emails from a mailbox, create letters, transfer letters MTA.
The scheme is as follows:
1. MUA generates the letter. As a MUA can act as an email program or web interface.
2. MUA passes the email of the sender MTA (relay), in the case of mail programs using SMTP Submission (SMTP with authorisation), in the case of the web interface, usually directly.
3. The sender MTA (relay) determines recipient's MTA (mail exchanger) via an MX or A DNS records.
4. The sender MTA (relay) sends the email to the recipient's MTA (mail exchanger) via the SMTP Protocol (without authentication)
5. MTA of a recipient or sends a letter to the MDA for local delivery to the mailbox (the usual way), or sends email to another MTA, for instance if the box is set to redirect.
6. MDA places the email in the recipient mailbox
7. MUA recipient receives a letter from the box through POP3, IMAP4, or the web interface
Good answer, can I ask another question? as Google understands that the letter is spam? inappropriate for your MX record is clear. But if the MX record is correct, where he goes back to watching? thank you - xzavier10 commented on June 14th 19 at 20:36
in a complex anti-spam systems, no single method of spam detection. There is a large set of features, there are signatures, there are reputational data, there are classifiers, including using machine learning, there is feedback from users. It is defined by "spamnot" individual letters or a newsletter. - Collin_Gutmann commented on June 14th 19 at 20:39
June 14th 19 at 20:35
Approximately

1. Write a letter.
2. It is placed in a queue to the MTA mail.ru
3. Leaving, passing through a series of MTA, reaches the end of what googleby
4. Is placed in the database in Google

Truncated.

MTU actually have no mail.ru and gmail
There's quite a fancy system to store emails, for searching the full database.
MUA in this case the web interface - xzavier10 commented on June 14th 19 at 20:38
no
then, too, the web interface + backend + database - Collin_Gutmann commented on June 14th 19 at 20:41
June 14th 19 at 20:37
c3ff4-tutorial44.jpg

Find more questions by tags System administrationSMTPPostfixE-mail