Email sending and receiving details

Source: Internet
Author: User
Tags imap nslookup nslookup command

From: http://wenku.baidu.com/view/a1f729ea6294dd88d0d26b23.html

 

MailCollectionSendingProcess Analysis

This document analyzes in detail the process of sending an email from the sender to receiving the email from the recipient, and describes the knowledge involved in this process, it lays a solid foundation for system administrators who have initial contact with the mail system to thoroughly learn the mail server configuration and anti-spam software or hardware configuration.

 

1) SMTPYesWords
A. the sender writes an email on his/her own mail client (such as outlook or Foxmail) And then presses the send button;
B. the sender mail client uses the domain name or IP address of the sender's previous configuration (SMTP server [Sender's company Post Office Server]). If identity authentication is required for sending emails, and the user name and password used by the sender to indicate the identity to the SMTP server), and establish a TCP connection to the sender's post office server port 25;
C. The sender's mail client sends a command to the sender's company's Post Office ServerHelo <SendingRecipient Host Name>OrEHLO <SendingRecipient Host Name>To indicate your identity to the sender's post office server;
D. The post office server of the sender company responds to the sender's mail client. If SMTP authentication is configured on the mail server, it also returns the Identity Authentication Encryption algorithm that it supports to the sender's mail client;
Note: The mail server can limit the mail client that can send emails through it in two ways to prevent itself from being used as an open relay to send spam:
One is limited by the IP address. For example, you can write the IP address segment of the client computer on which the mail server is responsible for sending the mail to the corresponding configuration file of the mail server;
Another method is to configure SMTP authentication. Only clients that pass identity authentication can send emails through it;

E. If the mail server uses SMTP authentication to restrict the mail client, the mail client of the sender sends a command to the mail server of the sender company.Auth <SendingPartsMailCustomerUserEndSelectEncryption Algorithm>, Send the algorithm you selected to the sender's company's post office server. Otherwise, go to step K;

F. The sender company's post office server responds to the sender's mail client and uses the encryption algorithm negotiated by both parties to encrypt the response data;

G. the sender's mail client sends a command to the sender's company's Post Office ServerUser <SendingPerson in useUserName>And use the encryption algorithm encryption commands negotiated by both parties;

H. The sender company's post office server responds to the sender's mail client and uses the encryption algorithm negotiated by both parties to encrypt the response data;

I. The sender mail client sends a command to the sender's company Post Office ServerPass <SendingConfidentialityCode>And use the encryption algorithm encryption commands negotiated by both parties;

J. The sender company's post office server responds to the sender's mail client and informs the sender of the mail client's identity verification results;

K. the sender's mail client sends a command to the sender's company's Post Office ServerMail from: <SendingPartsMailBox>, Telling the mail address of the sender of the post office server;

L. The sender's company post office server responds to the sender's mail client;

M. the sender's mail client sends a command to the sender's company's Post Office ServerRcpt to: <RecipientMailBox>, Telling the mailbox address of the recipient of the post office server;

N. the sender's company's Post Office Server determines whether the mail client is located in the IP address segment for which the mail is forwarded, or whether the client has passed SMTP authentication. If the client is in the IP address segment of the client, you can also use SMTP authentication to allow the client to send external emails. If the client is neither in its own IP address segment nor in SMTP authentication, the sender's company Post Office Server considers the sender's mail client as an external mail server and tries to send emails through it. Then, it judgesRCPTCommand ParametersRecipientMailBoxWhether it is a local mailbox, if yes, it is allowed to be sent, if it is an external mailbox, it is rejected, and the result is returned to the sender's mail client;

O. the sender's mail client sends a command to the sender's company's Post Office ServerData, Requires sending an email;

P. The sender's company post office server responds to the sender's mail client;

Q. the sender's mail client sends an email to the sender's company's post office server;

R. the sender's company post office server responds to the sender's mail client, tells it that the email has been received, and then closes the connection.

 

 

 

 

 

2) SMTPYesWords
A. the sender's company email server analyzes the received mail, extracts its "recipient's mailbox" section (for example, zoukj@sinogrid.com), and isolates the domain name sinogrid.com of the recipient's mailbox );
B. The mail server of the sender company performs DNS queries. The query category is Mx and the IP address of the mail server in the sinogrid.com domain is queried (you can use the NSLookup command to simulate NSLookup-type = Mx sinogrid.com );
C. the DNS server of the recipient company returns the mail server list of the company to the mail server of the sender company;
D. the sender's company email server analyzes the list of recipient's company email servers, finds the highest priority email server, and tries to establish a TCP connection with it. If there are multiple email servers with the highest priority, it can be used in turn. If you cannot establish a connection with an email server with a higher priority, you can establish a connection with a server with a higher priority, and so on.
Note: The MX query return value, such as sinogrid.com MX preference = 20 and mail exchanger = mail.sinogrid.com. The lower the value, the higher the priority of the email server corresponding to the record.
E. if the recipient's company email server is configured to filter out spam emails Based on the IP address of the sending mail server, it will match the IP address of the sender's company email server with its own blacklist and whitelist, if the IP address of the sender's company email server is in the blacklist, it may reject the connection from the sender's company email server;
F. The sender's company email server sends the command helo <sender's company email server Domain Name> or EHLO <sender's company email server Domain Name> to the recipient's company email server, indicating his identity;
G. response from the email server of the recipient company;
H. The sender's company email server extracts the "sender's mailbox" of the email to be sent, and sends the command mail from: <sender's mailbox> to the recipient's company email server;
I. If the recipient's company email server is configured with DNS reverse query verification, it will do this:
First, he performs a ptr dns query (search for domain names based on IP addresses) to find the domain name of the sender's company email server, then, execute an MX-type DNS query (based on the domain name to find the list of email servers responsible for this domain) to find the list of email servers responsible for the domain where the "sender mailbox" is located, determine whether the domain name of the sender's company email server is in this list. If the PTR-type DNS query fails (for example, we have not configured the DNS reverse query, you need to apply to the ISP for this), or the domain name is not in the list, the recipient's company email server rejects the email and terminates the session. Otherwise, if both conditions are met, send an "OK" response to the sender's email server.
J. The sender's email server sends a command to the recipient's company's Post Office ServerRcpt to: <RecipientMailBox>To tell the recipient's email address on the email server;
K. The recipient's company's Post Office Server determines the"RecipientMailBox"The address (such as the zoukj@sinogrid.com) is the mailbox address of the domain that you are responsible for shipping (these domains are written to the corresponding configuration file When configuring the mail server ), if the recipient's company email server is configured with the recipient address verification, it will also verify whether the address exists. If the domain or address is not in charge of itself, then it will prompt the sender's company email server. Otherwise, use "OK" to respond to the sender's company email server.
L. The sender's company email server sends commands to the recipient's company email serverDataCommand to send an email;
M. The mail server of the recipient company responds to the mail server of the sender company;
N. the sender's company email server sends an email to the recipient's company email server;
O. The recipient's company's post office server responds to the sender's company's mail server's sending commandQuitTo terminate the session.

 

 

3) POP3/IMAPYesWords
Generally, the mail server software, such as Sendmail, Qmail, and Postfix, is called MTA (mail sending proxy ), it is only responsible for sending emails to and from the local email users and receiving emails from external users to the local email users, it does not allow users to use the mail client software to read emails in their email addresses on the mail server, that is, POP3 or IMAP services. You can only use the command line to view emails in your mailbox on the mail server, which is inconvenient. Therefore, when setting up an email server, we need to install a POP3 or IMAP server to facilitate sending and receiving emails through the mail client;
The email receiving process is as follows:
A. The recipient clicks the "receive" button on the mail client;
B. based on the previous settings of the sender (POP3/IMAP Server [recipient company Post Office Server] domain name or IP address, and the username and password used by the recipient to indicate the identity to the POP3/IMAP Server ), establish a TCP connection to port 110 (POP3) or port 445 (IMAP) of the recipient's post office server;

C.The recipient company's post office server responds to the recipient's email client, indicating that you are ready to receive commands.

D. The recipient's mail client sends a command to the recipient's company's post office server.User <UseUserName>;

E. The recipient company's post office server responds to the recipient's mail client and requests the sending password;

F. The recipient's mail client sends a command to the recipient's company's Post Office ServerPass <PasswordCode>;

G. The recipient company's Post Office Server verifies the user name and password sent by the recipient's mail client, and notifies the recipient of the verification result. If the verification fails, the connection is closed;

Generally, we can configure the mail server to verify the user identity based on the account on the mail server's local machine, or verify according to the external user database, such as LDAP.

H. The recipient's mail client sends mail operation commands to the recipient's company's post office server, such as stat, UIDL, list;

I. The recipient mail client sends the command quit to the recipient's company's post office server to stop the session;

 

 

4)Summary
A properly configured email server already contains a variety of anti-spam technologies. Once we understand and grasp the entire process of sending and receiving emails, whether it is configuring the email server or anti-spam gateway, we can not only know what to do, and you know why you want to do that.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.