Linux Server: The principle of the mail system

Source: Internet
Author: User
Tags aliases auth command line mail exchange access mx record nameserver nslookup
What exactly is a mail server? The mail server provides the basic structure of the messaging system, including the ability to mail transfer, mail distribution, and mail storage to ensure that messages can be sent anywhere on your Internet network.

What exactly is a mail server? The mail server provides the basic structure of the messaging system, including the ability to mail transfer, mail distribution, and mail storage to ensure that messages can be sent anywhere on your Internet network. At present, advanced mail server will include: SMS Mail, Anti-Virus anti-spam module, Address Book function, user group function, collection POP3, mail server has two different application groups: ISP providers and enterprises. E-Mail is one of the Internet application services. The following details of the mail system specific technical points.
MUA (client program, such as Outlook)
MTA (mail transfer agent, message transfer agent)
MDA (mail delivery agent, message delivery Agent)
MRA (mail retrieval agent, message acquisition agent)
Real mail delivery process simulation
Assuming Alex is using a alex@gmail.com, then when Alex is sending a letter to john@yahoo.com, the following steps will follow:
· First, Alex writes a letter from a personal computer to the host of the gmail.com he belongs to.
· Gmail.com will first put the letter on its own machine registers.
· gmail.com checks the destination of the letter and looks for the IP address of the yahoo.com.
· The mail is then sent via the Internet to the yahoo.com mainframe.
· Yahoo.com host received the letter, found that the user of their own machine, so the letter to the user's new box.
· When John is free, turn on the computer from home and take the initiative to yahoo.com check for new letters and download them to their computer when new letters are found.
Every component on a network plays a different role in the process from letter to receipt
· Mail User agent (MUA): Mail user agent, which is used by users to write letters, receive letters of the program. For example, we often use Outlook exporess, Thunderbird, and so on. Its role is to provide users with a useful transceiver interface, and the letter to its own mail server.
· Mail Delivery agent (MDA): A mail delivery agent who is responsible for assigning messages to local users to the user's mailbox. In UNIX, the MDA is usually the mail program.
· Mail Transfer agent (MTA): A mail forwarding agent is a server that is responsible for forwarding letters. The Sendmail and Postfix used in UNIX are the MTA software. Its function is to receive the letter from the MTU, according to the letter address, the letter forwarded to the destination. At the destination, there is also another MTA that is responsible for receiving the letters. Sometimes the letters are not transmitted from the user's computer to the destination's host at once, but are forwarded to the destination's host via many MTAs. This MTA receives non-own letters and transfers to the other MTA is called "relay".
When we are sending a letter, we are using the SMTP (Simple Mail Transfer Protocol) communication protocol, on a mail server, you must first install the Mail Service software to receive the mail from the SMTP protocol. SMTP contracts are also used when transferring letters between the MTA and the MTA. When you receive a letter, you use either the POP3 (Post Office Protocol) or the IMAP (Internet message Access Protocol) contract.
What is Pop
The full name of the pop is the post Office Protocol, the Post Office Protocol, for incoming e-mail, which uses TCP's 110 port. Now commonly used is the third edition, so referred to as POP3. POP3 still uses client/server mode of work, client is referred to as clients, generally we use computers as clients, and server (server) is managed by network management personnel. For example, the server is a collection of many small mailboxes, like the structure of the mailbox of the building we live in, and the client is like a person holding the key to the mailbox to unlock the same truth.
Introduction to the working principle of pop
Let's take a look at the process of email software to collect e-mail, we usually set a POP server URL (such as pop) on the email software account attribute. 21CN. com), and the account number and password of the mailbox. This is used in the process of receiving letters. When we press the email software in the receiving key, the e-mail software will first invoke the DNS protocol to the POP server to resolve the IP address, when the IP address is resolved, the mail program began to use the TCP protocol to connect the mail server 110 port, because the POP server is relatively busy, So in this process we have to wait for a relatively long time. When the mail program successfully connected to the POP server, first will use the user command to the mailbox's account to the POP server, and then use the Pass command to the mailbox to the server, when the completion of this certification process, the mail program using the STAT command to request the server back to the mailbox statistics, such as the total number of messages and the size of the message, and then the list lists the number of messages in the server. The mail program then uses the RETR command to receive the message, and after receiving one, use the DELE command to put the message in the mail server to the deleted state. When you use quit, the mail server deletes the message that was placed as the deletion flag. Popularly speaking, the mail program receives the mail from the server, actually is a dialogue process, the pop agreement is uses in the email language.
Command line POP Mail
Telnet pop. 21CN. com 110
+ok Hermes POP Service () is ready.
User Mr22
+ok
Pass Svtest
+ok mr22@21cn.com has messages (3846240 octets)
Stats
+ok 42 3846240
List
+ok 42 3846240
1 637170
2 7047
3 1444
4 10938
5 3573
R ETR 6

Principles of the SMTP protocol
The smtp-Simple Mail Transfer Protocol (straightforward mail Transfer Protocol) is the protocol that defines the message transfer, which is a TCP service based application layer protocol.
Command line Send mail
EHLO xxxx
250-21cn.com, helo (delayed)
250-expn
250-help
250-8bitmime
250-auth=login PLAIN
250-auth LOGIN PLAIN
Xtmd
Auth Login
What is a domain name? What constitutes the domain name?
The domain name is used on the Internet to find a Web site, is an important sign on the Internet, equivalent to the host's house number. Each host corresponds to an IP address, each IP address consists of a series of numbers, such as 101.25.11.34. For the convenience of memory, people use domain names instead of these numbers to find a host, such as mydomain.com. Each domain name and IP address is one by one corresponding, people enter the domain name, and then by the Domain name server (DNS) resolved into IP address, so as to find the corresponding website. Each URL and email to use the domain name. In English international domain names, domain names can be English letters and Arabic numerals and the horizontal bar "-" composition, up to 67 characters (including suffixes), and the case of letters no difference, the maximum length of each level can not exceed 22 letters. In the domestic domain name, the three-level domain name length must not exceed 20 words.
What is DNS?
Domain name Management system DNS is the domain name resolution server. Its role in the Internet is to convert domain names into IP addresses that can be identified by the network. For example: The www.163.com that we enter when we surf the Internet will automatically convert to 202.108.42.72
What is a record?
A (address) record is a record of IP addresses that specifies the host name (or domain name). Users can point to the site server under this domain name to their own Web server. At the same time you can set your domain name level two domain name.
What is an NS record?
The NS (name server) record is a domain name server record that specifies which DNS server the domain name is parsed by.
What is an alias record (CNAME)?
Also known as canonical names. This record allows you to map multiple names to the same computer. A computer that is typically used to provide both the WWW and mail services. For example, there is a computer named "Host.mydomain.com" (a record). It also provides WWW and mail services to facilitate user access to services. You can set two aliases for this computer (CNAME): www and mail. The full name of these two aliases is "www.mydomain.com" and "mail.mydomain.com". In fact, they all point to "host.mydomain.com".
What is a generic domain name resolution?
Universal domain name resolution is defined as: The customer's domain name a.com, under the *.a.com all resolved to the same IP address up. For example, customers set up b.a.com will automatically resolve to the same IP address with a.com.
What is an MX record?
An MX (mail exchanger) record is a mail exchange record that points to a mail server that is used to locate a mail server based on the recipient's address suffix when the e-mail system sends a message. For example, when a user on the internet wants to send a letter to user@mydomain.com, the user's mail system finds an MX record of the domain name mydomain.com through DNS, and if the MX record exists, The user's computer sends the message to the mail server specified by the MX record.
Ways to check if MX records exist
A very useful tool for DNS queries is nslookup, which you can use to query the various data in DNS. You can run Nslookup directly under Windows command line into an interactive mode where you can query for various types of DNS data.
DNS name resolution data can be of various types, with the SOA type data setting this zone parameter, with the type a data for the IP address that sets the name, and the MX type data that sets the mail exchange. These different types of data can be queried through the Nslookup interactive mode, and the set type command can be used to set the corresponding query type during the query. such as: C:\>nslookupdefault Server: [202.106.184.166]address:202.106.184.166
> Set TYPE=MX
> Sina.com.cnDefault Server: [202.106.184.166]address:202.106.184.166
Non-authoritative Answer:
sina.com.cn MX preference = ten, mail exchanger = sinamx.sina.com.cn
sina.com.cn nameserver = ns1.sina.com.cn
sina.com.cn nameserver = ns3.sina.com.cnsinamx.sina.com.cn Internet address = 202.106.187.179sinamx.sina.com.cn Internet address = 202.106.182.230ns1.sina.com.cn Internet address = 202.106.184.166ns3.sina.com.cn Internet address = 20 2.108.44.55
If the MX record for a domain name that you want to check does not exist, a hint similar to the following appears: C:\>nslookup> set type=mx> amaxit.com.cnDefault Server: [202.106.184.166] address:202.106.184.166
202.106.184.166 can ' t find amaxit.com.cn:non-existent domain
The command confirms that the message is received. If the SMTP recipient receives it, the OK answer is returned, and if it is not received, a reject receive answer is issued (but the entire message operation is not aborted), and the two sides will repeat so many times. When the recipient receives all the messages, they receive a special sequence, and if the recipient successfully processes the message, return the OK answer. SMTP provides the mechanism for sending messages, and if the recipient is connected to the sender under the same transport service, the message can be delivered directly to the receiving host by the sender's host, or through a relay SMTP server when the two are not in the same delivery service.  In order to be able to provide relay capabilities to an SMTP server, it must have the final destination host address and mailbox name. The Mail command parameter is the reply path, which specifies where the message comes from, and the RCPT Command's argument is the forwarding path, which specifies where the message will go.  The forward path is the source path, and the reply path is the return path (it is used to return the message when an error occurs). When the same message is sent to a different recipient, SMTP encounters a problem of sending copies of the same data to different receivers, a strange syntax for mail commands and replies, and a numeric code for the answer. In the following example, you can see which of the actual commands and responses are used.  Complete command and answer in section fourth. Commands and answers are not case sensitive, that is, commands and answers can be uppercase, lowercase, or both, but this is not necessarily right for user mail names, because some hosts are sensitive to user name capitalization. In such an SMTP implementation.



Related Article

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.