Install configure sendmail software yuminstall-ysendmailsendmail-cfm4 set Sendmail service network access permissions vi/etc/mail/sendmail. mcDAEMON_OPTIONS ('Port = smtp, Addr = 127.0.0.1, & nb
Install and configure sendmail
Yum install-y sendmail-cf m4
Set network access permissions for the Sendmail service
vi /etc/mail/sendmail.mc
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
Change 127.0.0.1 to 0.0.0.0, which means that any host can access the Sendmail service. If only one CIDR block can access the Sendmail service, change 127.0.0.1 to a specific CIDR block address, such as 192.168.1.0/24.
Generate the Sendmail configuration file
The configuration file of Sendmail is generated by m4, and the m4 tool is in the sendmail-cf package. If the system cannot identify the m4 Command, the sendmail-cf package is not installed.
Generate the configuration file for Sendmail:
M4/Etc/mail/sendmail. mc>/Etc/mail/sendmail. cf
You must restart Sendmail to make the configuration file take effect.
Service sendmail restart
Add the machine name to/etc/hosts.
echo "" >> /etc/hosts
echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
Iptables configuration
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
service iptables save
service iptables restart
Test Email:
mail -s "hosts" xxxx@qq.com < /etc/hosts