Home >Operation and Maintenance >CentOS >What should I do if centos mail cannot be used?
The solution to centos mail not working: 1. Add a domain name; 2. Find "#Dj$w.Foo.COM" and change it to "Djtest.com"; 3. Restart the sendmail service.
The operating environment of this article: centos 6.4 system, Dell G3 computer.
What should I do if centos mail cannot be used?
Solutions to centos mail that cannot send emails:
Recently, centos 6.4 suddenly cannot send emails Email, I can’t receive the email even if I test it directly with the mail command
The following is the result after referring to the experience of the heroes
# yum install -y sendmail # yum install -y sendmail-cf m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf //生成配置文件
Sendmail email domain configuration
# vi /etc/mail/local-host-names,添加 test.com //添加域名 # vi /etc/mail/submit.cf,找到行 #Dj$w.Foo.COM,修改为 Djtest.com // #service sendmail restart 重启sendmail服务, 如果不是马上就重启了,可能需要配置下hosts
vim /etc/hosts
plus
127.0.0.1 xiaofei. xiaofei //xiaofei是主机的名称 #echo test| mail -s "test" your_email@site.com //测试发送邮件,检查一下是否能收到邮件
-------------
If from php When calling, in php.ini sendmail_path = "/usr/sbin/sendmail -fxx@xx.com -t -i " //The red letters represent the customized sender address..
If not Specify that when receiving the email, you will find that the email comes from apache@xx.com. apache is the system user of the server (apache or nginx, etc.). There may be other methods, but I haven’t found it yet....
Recommended tutorial: "centos tutorial"
The above is the detailed content of What should I do if centos mail cannot be used?. For more information, please follow other related articles on the PHP Chinese website!