Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install sendmail mail service in CentOS

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to install sendmail mail service in CentOS. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

1. Sendmail installation

Under CentOS, sendmail is generally installed with the operating system by default. If the sendmail service is not installed when the system is installed, it is also easy to install sendmail manually:

The code is as follows:

# yum install-y sendmail

# yum install-y sendmail-cf

2. SMTP authentication configuration of Senmail (this step can be ignored if authentication is not required)

First confirm that the saslauthd service is installed or started.

Install the saslauthd service:

The code is as follows:

# yum install-y saslauthd

Start the saslauthd service:

The code is as follows:

# service saslauthd start

(1) configure SMTP authentication for Senmail

The code is as follows:

# vi / etc/mail/sendmail.mc

The code is as follows:

Dnl TRUST_AUTH_MECH (`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN') dnl

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 the corresponding setting line can be opened by removing the dnl string at the beginning of the line.

(2) set network access permissions for Sendmail service

The code is as follows:

# vi / etc/mail/sendmail.mc

The code is as follows:

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 network segment has access to the Sendmail service, change 127.0.0.1 to a specific network segment address that looks like 192.168.1.0 and 24.

3. Generate Sendmail configuration file

The configuration file for Sendmail is generated by M4, and the M4 tool is in the sendmail-cf package. If the system does not recognize the M4 command, the sendmail-cf package is not installed.

Generate a configuration file for Sendmail:

The code is as follows:

M4 / etc/mail/sendmail.mc > / etc/mail/sendmail.cf

You need to restart Sendmail for the configuration file to take effect.

4. The conflict between postfix and sendmail.

After configuring sendmail on the Linux server (CentOS release 6.6), the test found a problem when sending mail, checked the status of the sendmail service, found it in "sendmail dead but subsys locked", and found that the postfix service was also running. You just need to stop the postfix service. Why did this happen? Something was occasionally causing the postfix service to start which then caused the status of sendmail to jump to dead but subsys locked. The two seem to be incompatible.

Procedure:

(1): check the status of the sendmail service

The code is as follows:

[root@DB-Server ~] # service sendmail statussendmail dead but subsys lockedsm-client (pid 22112) is running...

(2): check the status of the postfix service

The code is as follows:

[root@DB-Server ~] # service postfix statusmaster (pid 1777) is running...

(3): stop the postfix service

The code is as follows:

[root@DB-Server ~] # service postfix stopShutting down postfix: [OK]

(4): restart sendmail service

The code is as follows:

[root@DB-Server ~] # service sendmail stopShutting down sm-client: [OK] Shutting down sendmail: [FAILED] [root@DB-Server ~] # service sendmail stop [root@DB-Server ~] # service sendmail startStarting sendmail: [OK] Starting sm-client: [OK]

(5): disable postfix to start automatically after reboot

Check to see if postfix is set to start automatically after reboot

The code is as follows:

Chkconfig-- list | grep postfix

Chkconfig postfix off

After reading the above, do you have any further understanding of how to install sendmail mail service in CentOS? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 282

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report