CentOS SendMail installation and mail domain configuration

Source: Internet
Author: User
Tags ip name lookup mx record nslookup

Endmail is an excellent mail system under Linux. In the case of no setting, the email source address of SendMail e-mail is like [email protected], which will almost be identified by all the mailboxes as spam (spam) or directly rejected.

1, SendMail Installation

Under CentOS, SendMail is typically installed with the operating system by default. If the SendMail service is not installed when the system is installed, manually installing SendMail is also simple:

View PlainCopy
    1. # yum Install-y sendmail

    2. # yum Install-y sendmail-cf

2, Senmail SMTP authentication configuration (do not need authentication to ignore this step)

First verify that the SASLAUTHD service is installed or started.

Install SASLAUTHD service: # yum Install-y SASLAUTHD

Start SASLAUTHD Services: # service SASLAUTHD start

(1) Configuring SMTP authentication for Senmail

# VI/ETC/MAIL/SENDMAIL.MC

View PlainCopy
    1. DNL Trust_auth_mech (' EXTERNAL digest-md5 cram-md5 LOGIN PLAIN ') dnl

    2. DNL define (' confauth_mechanisms ', ' EXTERNAL GSSAPI digest-md5 cram-md5 LOGIN PLAIN ') dnl

Remove the DNL from the above two lines. In the SendMail file, DNL indicates that the behavior comment line is invalid, so you can open the corresponding setting line by removing the DNL string at the beginning of the row.

(2) Setting up network access for SendMail services

# VI/ETC/MAIL/SENDMAIL.MC

View PlainCopy
    1. Daemon_options ('port=SMTP,addr=127.0.0.1, name=MTA ') dnl

Change 127.0.0.1 to 0.0.0.0, meaning that any host can access the SendMail service. If only one segment is allowed to access the SendMail service, change 127.0.0.1 to a specific segment address that is shaped like 192.168.1.0/24.

3. Generate SendMail configuration file

The SendMail configuration file is generated by M4 and the M4 tool is in the SENDMAIL-CF package. If the system does not recognize the M4 command, it indicates that the SENDMAIL-CF package is not installed.

To generate a SendMail configuration file:

View PlainCopy
    1. M4/ETC/MAIL/SENDMAIL.MC >/ETC/MAIL/SENDMAIL.CF

A restart of SendMail is required for the configuration file to take effect.

4, sendmail mail domain name configuration

Configure SendMail to use a legitimate domain name in two steps, modify the SendMail profile and add the domain name MX record.

SendMail can directly use the "-R [E-Mail protected]" parameter to send mail at any source address, but the current mainstream mailbox will be the source address and reverse resolution IP comparison, if the resolution is not resolved or the IP mismatch, light will be directly classified as spam mail, Serious will directly refuse to receive.

The MX record (mail Exchanger record) is primarily used when mail is received, that is, when a new message is posted, the MX record of the recipient's domain name is queried and then posted via the IP address obtained by the MX record. At the same time, the mail maker will also compare the source address and MX record when receiving the mail, as one of the criteria of spam judgment.

First step: Add a domain name

(1) Adding a domain name to the Local-host-names file

# vi/etc/mail/local-host-names, adding

View PlainCopy
    1. Sunchis.com

(2) Modify the submit.cf file

# VI/ETC/MAIL/SUBMIT.CF, find the line #Dj $w. foo.com, modified to

View PlainCopy
    1. Djsunchis.com

At this point, the SendMail message naming configuration is complete, and restarting SendMail makes the configuration effective.

Step Two: Add the domain name MX record

Find the page to modify the domain name information (different domain name Registrar page is not the same), the results of the changes will be effective in 24 hours at the latest due to the different domain name vendors.

(1) Add the domain A record mail, pointing directly to your mail server's static IP address:

(2) Add (or modify) The MX record of the domain name, such as:

(3) Use Nslookup to detect if the MX record resolves correctly to the mail server

View PlainCopy
    1. # nslookup

    2. > Set q=mx

    3. > sunchis.com

    4. server:8.8.8.8

    5. address:8.8.8.8#53

    6. Non-authoritative Answer:

    7. Sunchis.com mail exchanger = ten mail.sunchis.com.

    8. Authoritative answers can found from:

    9. >

OK, the domain name corresponding to the mail server has been resolved correctly.

5, relaying denied (refuse delivery) of the resolution

Appear 550 5.7.1 <[email protected]> Relaying denied. IP name lookup failed [192.168.1.133] exception, because the SendMail as a mail broker, you need to add the client's IP address to the access configuration file.

# vi/etc/mail/access, adding

View PlainCopy
    1. connect:192.168.1.133 RELAY

To regenerate access to the database:

View PlainCopy
    1. # cd/etc/mail/

    2. # makemap Hash access.db < access

In this way, the problem will be solved.

CentOS SendMail installation and mail domain configuration

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.