SendMail Mail Server Quick Guide (1)

Source: Internet
Author: User
Tags final mail query mail exchange mx record
Servers | Mail servers Most people use e-mail on the Internet, and many corporate users often use free e-mail systems. In this paper, we guide users from SendMail source code to build a mail system that can meet the basic needs of work.

Overview SendMail is the most important message transfer agent. It is important to understand the working mode of e-mail. In general, we decompose email programs into user agents, transport agents, and delivery agents. The user agent is used to accept the user's instructions, sending the user's letters to the letter transfer agent, such as Outlook Express, Foxmail, etc. The delivery agent obtains the letter from the letter transfer agent to the end user's mailbox, for example: Procmail.

When a user tries to send an e-mail message, he cannot send the letter directly to the other's machine, and the user agent must try to find a letter transfer agent and submit the message to it. After the letter transfer agent gets the message, it first saves it in its own buffer queue, and then, depending on the destination address of the message, the letter transport agent finds the message transfer proxy that should be responsible for the destination address and delivers the message to it over the network. After the other's server receives the message, it stores the buffer locally until the recipient of the email sees its e-mail.

Obviously, the message transfer is from the server to the server, and each user must have the space (called the mailbox) where the information is stored on the server to accept the message (the message is not sent by this restriction). As you can see, the primary job of a message transfer agent is to monitor the user agent's request, locate the corresponding mail server based on the destination address of the e-mail message, transfer the mail between the servers, and buffer or submit the received message to the final delivery program. There are a number of programs that can act as message transfer agents, but SendMail is one of the most important, and it turns out that it can support thousands of or even more users, and that it takes up very little system resources. However, the configuration of SendMail is very complex, so some other tools, such as qmail, Postfix and so on, are also used.

When the SendMail program gets a message to be sent, it needs to determine the delivery of the letter to the corresponding server based on the destination address, which is implemented through the DNS service. For example, the destination address of an e-mail message is ideal@linuxaid.com.cn, then SendMail first determines that the address is a username (ideal) + The format of the machine name (linuxaid.com.cn), and then query DNS to determine the need to post the letter to a server.

In DNS data, an MX record is associated with an e-mail message, such as the following setting in the DNS data file for this domain in linuxaid.com.cn:

In MX ten Mail
In MX Mail1
Mail in A 202.99.11.120
Mail1 in A 202.99.11.121

Obviously, in DNS, linuxaid.com.cn has two mail exchange (MX) servers, so SendMail tries to send the message to either of them. In general, the priority of the MX server in front is higher, so the server will attempt to connect the mail.linuxaid.com.cn 25 port, trying to forward the message to it. If successful, your SMTP server's task is complete, and after that, the task will be completed by mail.linuxaid.com.cn. In general, mail Converter will automatically transfer the contents of the letter to the target host, however, there are also cases where The target host, such as linuxaid.com.cn, may not exist, or do not perform the SMTP service, but rather by its MX switch to perform the management of the letter, the final letter will be saved on the MX machine until the user sees it.

If a DNS query cannot find an MX record for an address (usually because the other person does not have a mail exchange host), then SendMail will be trying to talk directly to the host from the mail address and send the message. For example, there is no corresponding MX record in Test@aidgroup.linuxaid.com.cndns, so SendMail will obtain the IP address from DNS and attempt to send the message directly to the other party after determining that the MX switch failed.

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.