Server Configuration for SMEs-email server (2)

Source: Internet
Author: User
Tags valid email address mx record
Article Title: server configuration for small and medium-sized enterprises-Mail Server (2 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   Section 3 important email system agreements
& Amp; 3.1 SMTP protocol:
1. SMTP works in two situations: one is to transfer an email from the client to the server, and the other is to transfer it from one server to another.
  
2. SMTP is a request/response protocol. commands and responses are based on ASCII text and end with CR and LF characters. The response includes a three-digit code indicating the returned status.
  
3. SMTP listens for connection requests on TCP port 25
  
4. Connection and sending process:
  
A. Establish a TCP connection
B. The client sends the HELO command to identify the sender, and then the client sends the MAIL command. The server wants to use OK as a response, indicating that it is ready to receive
C. The client sends the RCPT command to identify the recipient of the email. If there are multiple RCPT row servers, it indicates whether the recipient is willing to receive the email.
D. After the negotiation ends, send an email and use the command DATA to send it.
E. End the input content and send it together.
F. End sending and exit with the QUIT command.
  
5. Two other commands:
  
VRFY --- used to verify whether a given user's email address exists and receive detailed information about the user.
EXPN --- used to expand the mail list.
  
6. mail routing process:
  
The SMTP server routes emails based on the domain name of the recipient in the 'domain Name Service DNS. The SMTP server routes emails Based on the MX record in the DNS. The MX record registers the domain name and the related SMTP relay host. All emails belonging to the domain should be sent to the host.
  
If the SMTP server mail.abc.com receives a letter to be sent to the shuser@sh.abc.com:
  
A. Sendmail requests DNS to provide the CNAME record of host sh.abc.com. If yes, if CNAME is sent to shmail.abc.com, it requests the CNAME record of shmail.abc.com again until it does not exist.
B. Assume that the CNAME is sent to shmail.abc.com, and then the DNS of the sendmail request @ abc.com domain gives the MX record of shmail.abc.com,
Shmail MX 5 shmail.abc.com
10 shmail2.abc.com
C. Sendmail finally requests dns to give the record of shmail.abc.com, that is, IP address. If the returned value is 1.2.3.4
D. Sendmail connects to 1.2.3.4 and sends the mail to the shuser@sh.abc.com to the SMTP background program on this server 1.2.3.4
  
7. SMTP basic command set:
  
Command description
HELO identifies a user to the server
The sender can cheat and lie, but generally the server can detect it.
MAIL initialization Email transmission
Mail from:
RCPT identifies a single email recipient, often behind the MAIL command
Multiple rcpt:
After one or more RCPT commands, DATA indicates that all Email recipients have been identified, and DATA transmission is initiated to end.
VRFY is used to verify whether the specified user or email address exists. This command is often disabled by the server for security reasons.
EXPN verifies whether the specified mailbox list exists and expands the mailbox list.
HELP query commands supported by the server
No NOOP operation, the server should respond OK
QUIT end session
RSET resets the session and the current transmission is canceled.
  
8. the address specified in the mail from command is called envelope from address. It does not need to be the same as the sender's own address.
Rcpt to is equivalent to the following: the specified receiver address is called envelope to address, but it has nothing TO do with the actual to: What is the row.
  
9. Why is there no rcpt cc or rcpt bcc :?
All receiver negotiation is implemented through the rcpt to command. If it is BCC, the recipient of the envelope is deleted after the negotiation is sent and received by the recipient.
  
10. emails are divided into envelope, header, and body.
Envelope from, envelope to and message from:, message to: are completely irrelevant.
Evnelope is provided by the SMTP backend between server hosts, while message from/to is provided by users. It is also different if there is a colon.
  
11. How can I check whether a letter is forged in the envelope part?
  
A. correlated ed rows are correlated.
In the current SMTP mail transmission system, in addition to the internal hosts at both ends of the envelope, consider the section between the two company firewalls. If the two firewall machines are A and B, but the receiver checks the envelope written ed: When the row is found to pass through C. it is forged.
  
B. received: whether the host and IP address pairs in the row correspond:
Receibed: from galangal.org (turmeric.com [104.128.23.115] by mail .bieberdorf.edu ....
  
C. Manually added to the final stored row:
Received: from galangal.org ([104.128.23.115]) by mail .bieberdorf.edu (8.8.8.5)
Received: from lemongrass.org by galangal.org (8.7.3)
Received: from graprao.com by lemongrass.org (8.6.4)
& Amp; 3.2 POP3 Protocol Specification
1. Introduction
  
For small nodes on the network, it is impractical to support the message transmission system (mts. For example, a workstation may not have sufficient resources to allow the smtp server and a considerable number of local email delivery systems to stay in sequence and run continuously. Similarly, the cost of connecting a personal computer to an ip network over a long period of time is considerable (the lack of resources at a node is called "connection "). Even so, it is very useful to allow mail management on such summary points, and these nodes often support a user agent to manage mail. To solve this problem, the nodes that support mts provide the mail storage function for those nodes that cannot be supported. The Post Office Protocol-Version 3 enables such workstations to use a more practical method to access stored mails stored on servers. Generally, this means that the workstation can get the mail from the server, and the server temporarily saves the mail for it. In the following section, a client host refers to a host that uses the pop3 Service, and a server host refers to a host that provides the pop3 service.
  
2. Simple Description
  
This document does not specify how the client host sends messages to the transfer system. But here is a description: when the user agent needs to send the information to the transfer system, it establishes an smtp connection on the Relay host (these can be pop3 hosts, or not ).
  
3. Basic operations
  
Initially, the server listens to tcp port 110 to start the pop3 service. When the customer host needs to use the service, it establishes a tcp connection with the server host. After the connection is established, pop3 sends a confirmation message. The client and pop3 server exchange commands and responses to each other (respectively). This process continues until the connection is terminated. The pop3 command consists of a command and some parameters. All commands end with a crlf pair. Commands and parameters are composed of printable ascii characters separated by spaces. The command generally contains three to four letters, but each parameter can be up to 40 characters long. A pop3 response consists of a status code and a command that may contain additional information. All responses are also ended by the crlf pair. There are two status codes: "OK" ("+ OK") and "failed" ("-err "). The response to a specific command is composed of many characters. In these cases, the following statements are one by one: after the first line of response and a crlf are sent, any additional information lines are sent, and they are also ended by the crlf pair. When all messages are sent, the last line is sent, including an ending character (decimal code 46, that is, ".") and a crlf pair. If any row in the Information starts with an ending character, this row is filled by Preloading and ending the row. Therefore, the multi-line response is ended by five crlf. crlf. When multiple lines are detected, the customer checks to confirm whether the line starts with an ending character. If yes, and the subsequent character is not crlf, the first character (ending character) of this line will be discarded; if it is followed by crlf, the response from the pop server will terminate, including. crlf rows are not considered part of Multiline responses. In the lifecycle, pop3 sessions have several different states. Once the tcp connection is enabled and the pop3 server sends a confirmation message, the process enters the "OK" status. In this status, the customer must confirm with the pop3 server that he is the customer. Once confirmed, the server obtains the resources related to the customer's email, and the process enters the "operation" status. In this status, the customer proposes a service. When the customer issues a quit command, the process enters the "Update" status. In this status, the pop3 server releases the resources obtained in the "operation" status, sends a message, and terminates the connection. The pop3 server can have a logon logout record. This note must be recorded for at least 10 minutes. In this way, the message sent from the customer can be refreshed. When the note expires, the pop3 session does not enter the "Update" status, but closes the tcp connection, does not delete any messages, and does not send any response to the customer.
  
4. "OK" status
  
When a tcp connection is opened by a pop3 client, the pop3 server sends a single row for confirmation. This message can be any character ending with crlf. For example, it can be: s: + OK pop3 server ready. Note: This message is a pop3 response. The pop3 server should provide a "OK" response for confirmation. The pop3 session enters the "OK" status. In this case, the customer must prove its identity to the server. This document describes two possible processing mechanisms: user and pass commands, and apop commands to be introduced later. The customer must first send the user command to confirm the process by using the user and pass commands. If the pop3 server responds with a "OK" status code, the customer can send the pass command to complete the confirmation, or send the quit command to terminate the pop3 session. If the pop3 server returns the "failed" status code, the customer can send the confirmation command or the quit command again. After the customer sends the pass Command, the server determines whether to allow access to the corresponding storage mail based on the additional information of the user and pass commands. Once the server decides to allow customers to access and store emails through the data, the server will add an exclusive lock to the emails to prevent changes to the emails before entering the "Update" status. If the exclusive lock is successfully obtained, the server returns a "Confirm" status code. The session enters the "operation status" and no emails are marked as deleted. If the email cannot be opened for some reason (for example, the exclusive lock cannot be obtained, the customer cannot access the corresponding email or the email cannot perform syntax analysis), the server returns the "failed" status code. After the "failed" status code is returned, the server closes the connection. If the server does not close the connection, the customer can resend the confirmation command, start again, or send the quit command. After an email is opened on the server, it specifies a message number for each message and represents the length of each message in octal. The first message is specified as 1, the second message is specified as 2, and so on. The Nth message is specified as n. In pop3 commands and responses, the message number and length are in decimal format.
  
The following is a summary of the above three commands:
Command
Format
Parameters
Restrictions
Response
User name
Specifies the mailbox string, which is critical to the server only when the user and pass commands fail or are used in the "OK" status
+ OK: valid email address;

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.