Architecture memo 2 for Sendmail and Postfix

Source: Internet
Author: User
Tags mx record

 

 

I. Two ways to send an email:

1. Fast sending of mail commands
1) mail-s "hello from mzone. CC by shell" admin@mzone.cc
2) Hello, this is the content of mail.
3) Welcome to www. mzone. CC
The first line is the input command,-s indicates the subject of the mail, followed by the admin@mzone.cc is the recipient of the mail, enter this line of command and press enter, will enter the body of the mail writing, we can input any text, such as the above two lines. After entering the body of the email, press Ctrl + D to complete the input. At this time, you will be prompted to enter the CC address, that is, the CC address. If you do not press enter, the email will be sent.

2. The sending of SMTP commands is cumbersome and the interaction process is understood.
1) Telnet smtpserver 25

2) helo localhostname

3) mail from: user1@domain1.com sender

4) rcpt to: admin@mzone.cc Receiver

5) Data initialization content
From: user1@domain1.com
To: user2@domain2.com
Subject: hello from mzone. CC by Shell
Hello, this is the content of mail. Welcome to www. mzone. CC
. "Full" indicates that the text is over, just like Ctrl + D above.
 
6) quit

II. Understanding relay: Relay indicates that the SMTP server is a node on the SMTP server link. But not the final node. The relay node is retransmitted, but the final node is not transferred.

3. Error scenario: Sometimes an email can be received or cannot be received.
It is reasonable to say that multiple servers corresponding to the Web application will be locally retransmitted to adm01c. However, it is found that some newly added web application servers do not write logs in/var/log/mail/maillog.
Verification Method: grep smart/etc/mail/sendmail. Mc does not find the corresponding content. Check whether Sendmail is not installed on these newly added servers, which leads to a problem with their mail function.

Solution:
Install Sendmail: Check sendmail-CF instead of Sendmail.
Yum search sendmail-cf
Yum install sendmail-CF-y
Modify the smart_host value of the/etc/mail/sendmail. Mc file. And outputs to the sendmail. cf file through M4 compilation. Before compiling, back up the old sendmail. cf file. Start # service Sendmail start

4. Postfix Log Analysis
The following is a log segment for successfully sent emails:
Feb 23 01:53:20 adm01c Postfix/smtpd [15584]: connect from web04c.daodao.com [192.168.1.114]
Feb 23 01:53:20 adm01c Postfix/smtpd [15584]: 7cd1c1c00121: client = web04c.daodao.com [192.168.1.114]
Feb 23 01:53:20 adm01c Postfix/cleanup [15587]: 7cd1c1c00121: Message-id = <201202230652.q1N6poqV005021@web04c.daodao.com>
Feb 23 01:53:20 adm01c Postfix/qmgr [19139]: 7cd1c1c00121: From = <support@daodao.com>, size = 566, nrcpt = 1 (queue active)
Feb 23 01:53:20 adm01c Postfix/smtpd [15584]: disconnect from web04c.daodao.com [192.168.1.114]
Feb 23 01:53:22 adm01c Postfix/SMTP [15588]: 7cd1c1c00121: To = <bogaoyi@gmail.com>, relay = gmail-smtp-in.l.google.com [209.85.225.26]: 25, delay = 2.4, delays = 0.06/0.01/1.1/1.2, DSN = 2.0.0, status = sent (250 2.0.0 OK 1329980002 vw6si606526igb. 60)
Feb 23 01:53:22 adm01c Postfix/qmgr [19139]: 7cd1c1c00121: removed

Feb 23 02:13:28 adm01c Postfix/SMTP [17246]: connect to pp.com [74.117.114.92]: Connection timed out (port 25)
Feb 23 02:13:28 adm01c Postfix/SMTP [17246]: 9bc951c00123: To = <1158824774@pp.com>, relay = none, delay = 262614, delays = 262584/0. 01/30/0, DSN = 4.4.1, status = deferred (connect to pp.com [74.117.114.92]: Connection timed out)
Feb 23 02:14:27 adm01c Postfix/smtpd [17319]: connect from bak01c.daodao.com [192.168.1.131]
Feb 23 02:14:27 adm01c Postfix/smtpd [17319]: 800b21c00121: client = bak01c.daodao.com [192.168.1.131]
Feb 23 02:14:27 adm01c Postfix/cleanup [17321]: 800b21c00121: Message-id = <1919695525.581329981267430.JavaMail.root@bak01c.daodao.com>
Feb 23 02:14:27 adm01c Postfix/smtpd [17319]: disconnect from bak01c.daodao.com [192.168.1.131]
Feb 23 02:14:27 adm01c Postfix/qmgr [19139]: 800b21c00121: From = <support@daodao.com>, size = 7617, nrcpt = 2 (queue active)
Feb 23 02:14:28 adm01c Postfix/SMTP [17064]: 800b21c00121: To = <112733485@qq.com>, relay = mx3.qq.com [113.108.76.219]: 25, delay = 0.99, delays = 0.02/0/0.23/0.74, DSN = 2.0.0, status = sent (250 OK: queued)
Feb 23 02:14:29 adm01c Postfix/SMTP [17244]: 800b21c00121: To = <support-daodao@tripadvisor.com>, relay = webmail.tripadvisor.com [146.115.38.21]: 25, delay = 2.3, delays = 0.02/0/1.3/0.9, DSN = 2.0.0, status = sent (250 2.0.0 OK: queued as 090e51798d5cc)

In the Postfix log:
If status = sent, the message is successfully sent. Removed indicates that the sent email is deleted from the queue.
If status = deferred indicates that the request is extended and you need to retry. If the request is retried for a certain number of times but fails, discard the request.

5. MX record
I initially thought that the mail was not sent because of MX record problems. MX is one of multiple types of DNS records. DNS uses a record frequently. It is used to retrieve the domain name following the route according to the mailbox corresponding to rcpt.
The following is the MX route error of Postfix. Because the user writes Sina as Sian and TripAdvisor writes it as tripdvisor, the route cannot be routed.
Feb 23 02:13:05 adm01c Postfix/SMTP [17064]: 48f561c00080: To = Feb 23 02:13:05 adm01c Postfix/SMTP [17244]: 412c31c0011c: To = <lsbg4228575@sian.com>, relay = none, delay = 92243, delays = 92236/0. 01/7/0, DSN = 4.4.3, status = deferred (host or domain name not found. name Service error for name = sian.com type = mx: Host not found, try again)
Feb 23 02:13:10 adm01c Postfix/SMTP [17245]: c9ea01c0003c: To = <gpotter@tripdvisor.com>, relay = none, delay = 322597, delays = 322586/0. 01/12/0, DSN = 4.4.3, status = deferred (host or domain name not found. name Service error for name = tripdvisor.com type = mx: Host not found, try again)

 

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.