-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
207 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -520,4 +520,13 @@ unicast | |
multicast | ||
CSMA | ||
|
||
priv | ||
priv | ||
|
||
gmail | ||
SMTP | ||
linode | ||
sendmail | ||
procmail | ||
maildrop | ||
dovercot | ||
imaps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
# Linux Email Service | ||
|
||
The email services. | ||
|
||
Born in 1960s. | ||
|
||
Consists of many components. Not achieved by single service. | ||
|
||
For formal communications. | ||
|
||
## Basics | ||
|
||
Below is one possible email infrastructure. | ||
|
||
[schema](https://i.imgur.com/PVyVugV.png) | ||
|
||
### MxA | ||
|
||
MSA (Mail Submission Agent) will be ignored for simplicity. | ||
|
||
MUA | ||
|
||
* Mail User Agent | ||
* The client software, such as Thunderbird. | ||
* And the web email applications, such as Gmail web app. | ||
|
||
MTA | ||
|
||
* Mail Transfer Agent | ||
* Server-side program. | ||
*Implements SMTP, transfers the email. | ||
|
||
MDA | ||
|
||
* Mail Deliver Agent | ||
* When MTA receives new email, MDA will store the email to the server. | ||
|
||
MRA | ||
|
||
* Mail Receive Agent | ||
* Implements IMAP or POP3. | ||
* Communicates with clients, sends email to clients using IMAP or POP3. | ||
|
||
### Main Protocols | ||
|
||
SMTP | ||
|
||
* Simple Mail Transfer Protocol | ||
* All emails are sent using SMTP | ||
|
||
IMAP | ||
|
||
* Internet Message Access Protocol | ||
* Email clients use IMAP to fetch emails from server | ||
|
||
POP3 | ||
|
||
* Post Office Protocol | ||
* Email clients use IMAP to fetch emails from server | ||
|
||
## MUA | ||
|
||
Email Client. | ||
|
||
The only component that users can interact directly with. | ||
|
||
Common ones: | ||
|
||
* outlook | ||
* mac mail | ||
* thunderbird | ||
* mutt | ||
|
||
Web-based MUA is more common: gmail | ||
|
||
## IMAP POP3 | ||
|
||
The standard protocols used for communications between email clients and servers. | ||
|
||
MUA uses IMAP and POP3 to **retrieve** emails. | ||
|
||
Users can decide if they want to keep the emails in the server | ||
after retrieval. Decades ago it was crucial since the storage | ||
is limited, but today people don't care anymore. | ||
|
||
### Difference between IMAP and POP3 | ||
|
||
IMAP will "sync" all the operations, including read/unread, star and so on. | ||
|
||
POP3 downloads all the emails. All the operations are local and they do | ||
not affect the ones in the server. | ||
|
||
Again, this is a question of old days. Due to stability and bandwidth limit, | ||
people in old days prefer POP3 since it was more stable. But today IMAP is | ||
recommended. | ||
|
||
## MTA SMTP | ||
|
||
The actual email server software component. | ||
|
||
Uses SMTP (simple email transfer protocol) to **send** emails. | ||
|
||
MUA uses SMTP to communicate with MTA. | ||
|
||
MTA is responsible for communication between different mail servers. | ||
|
||
Common MTA: | ||
|
||
* sendmail | ||
* postfix | ||
|
||
MTA is only responsible for *transferring* emails. | ||
|
||
## MDA | ||
|
||
Stores the emails received by MTA to the server. | ||
|
||
Usually MTA and MDA are closely related, but still separated. | ||
They can be treated as a whole. | ||
|
||
Path ([How can I find my local mail spool?](https://unix.stackexchange.com/questions/82910/how-can-i-find-my-local-mail-spool)): | ||
|
||
```bash | ||
/var/spool/mail/$USER | ||
``` | ||
|
||
Why Separated from MTA | ||
|
||
* MDA can also filter the spam emails and scan the virus. | ||
* Please look this up on your own :) | ||
|
||
Common MDA | ||
|
||
* procmail | ||
* maildrop | ||
|
||
The default MDA of sendmail and postfix is procmail. | ||
|
||
## MRA | ||
|
||
Implements IMAP, POP3. | ||
|
||
Communicates with MUA. Will return the emails via IMAP or POP3 after | ||
MUA requests them. | ||
|
||
The only part that MUA interact with when retrieving emails. | ||
|
||
The reason why we need to provide 2 addresses for the MUA config | ||
|
||
* SMTP -> MTA | ||
* IMAP/POP3 -> MRA | ||
|
||
Common MRA | ||
|
||
* Dovercot | ||
|
||
Usually will encrypt the communication. So people today | ||
have 2 more protocols: | ||
|
||
* IMAPS | ||
* POP3S | ||
|
||
## Email Address | ||
|
||
There are 2 types of email addresses. | ||
|
||
```bash | ||
user@mail.web.net | ||
username@hostname-of-email-server | ||
|
||
user@web.net | ||
username@domain | ||
``` | ||
|
||
The second one is more common. | ||
|
||
But it does not specify the email server (the actual server | ||
that processes emails). | ||
|
||
And MX record is used in such situation. | ||
|
||
Use DNS to lookup the MX record to get the actual address | ||
of the mail server. | ||
|
||
```bash | ||
dig -t mx gmail.com | ||
``` | ||
|
||
## Read More | ||
|
||
* [Running a Mail Server - Linode](https://www.linode.com/docs/email/running-a-mail-server/) | ||
* [Extended SMTP - Wikipedia](https://en.wikipedia.org/wiki/Extended_SMTP) | ||
* [8.5. Setting Up Your System To Use E-Mail](https://www.debian.org/releases/stable/i386/ch08s05.html.en) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile modified="2019-03-06T01:49:01.436Z" host="www.draw.io" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36" etag="yE0cKu0oV7m-42QVNwcW" version="10.3.5"><diagram id="f3yCX5TD64I2UJzRTuK2" name="Page-1">7Vpbl5s2EP41Pqd9yB4QYOxHe71Ocxp33do53TxqQQtqMHKFfM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9cQunW4hR24qvc50BbH42ySIvoPdSnwsq5TsV9xkmje9yrT0mwCnW5g74Hyaf9MLNVt3Ihri3oZuj6dMFPsj8VGQiL0RTBLsXc/nG2d8fuH4K4Q5ZAzRONUAI1+zy6SaNaPCK5dpZ94PKF3t2CF7mAuy5wQzh8VNPRiWmJNNU9bKyaM1BEovRAdlb5zhoDXEyQEPJ2ZyM74+YKfYj9033hxX2WuV7HkhG0G+JY5r8A27RL+GSD/yMr7E4vM4YMye0qXzCPX1AExe+EMfJQzHfGlJLOyr3o93y9WZbtHV2W5FeLErdoJ1NV+nh32ewBkfZqM5b2/+OLe6tQLlYOM6+goMbxps9PjudgxyCxRzqorLpAvFdy7mX75mji7/fNh6+A8=</diagram></mxfile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters