标签:部署sendmail
简介:
如何在Linux环境中配置sendmail,以及出错了如何修复。
配置文件1:/etc/hosts
127.0.0.1 should go on the first line.
The first entry for 127.0.0.1 MUST be localhost.localdomain
The last entry for 127.0.0.1 SHOULD be the hostname, ex: srv-etam-cn-web1
The first entry for the internal IP SHOULD be a FQDN, ex: srv-etam-cn-web1.etam.com.cn
127.0.0.1 localhost.localdomain srv-etam-cn-web1 srv-etam-cn-web1.localdomain localhost srv-etam-cn-web1
10.16.1.48 srv-etam-cn-web1.etam.com.cn news.etam.com.cn
配置文件2:/etc/mail/sendmail.cf
Find the line starting with "Dj". This should an FQDN
Djsrv-etam-cn-web1.etam.com.cn
Run make and restart sendmail
修复问题:
1、 nscd
nscd should be turned off for testing due to caching DNS lookups and probably changes to /etc/hosts
/etc/init.d/nscd stop
2、 Test sending an email
Send a test email to yourself. You more then likely will not receive it even if sendmail is working (blocked by gmail, not customer server), but you can check the logs to see if sendmail sent it.
echo "hi" | mail -s "Test email" "adam.landas@gmail.com"
tail -n30 -f /var/log/maillog
If you see ‘stat=Sent‘, that means emails can be sent from this server. It however does not mean that emails can be received by other mail servers.
3、 Checking Blacklist
If you you get a ‘stat=Sent‘, but email still fails, you might be blacklisted, please use the below link to check:
Find the servers ip: curl ifconfig.me
Check that ip on this site: http://www.mxtoolbox.com/blacklists.aspx
4、 Misc
5、 Checking mailq
In some cases, a large amount of mail will build up in the mail queue. This can cause preformance issues as sendmail is in a constant state of reading and writing to /var/spool/clientmqueue.
Type: "mailq | tail -n10
Check the total size
Check to see why the mail is not being delivered
Connection timed out usually means a network error, or the receiving mail server is down. Try telneting that servers 25 port to test connectivity
Connection refused:
This could be because the upstream mail server has blacklisted the server via RBL‘s. Please see the "Checking Blacklist" of this wiki.
Some of our customer use a 3rd part sender to filter outbound mail. Check with the customer about that 3rd parties settings.
本文出自 “Linux和网络” 博客,转载请与作者联系!
标签:部署sendmail
原文地址:http://haohaozhang.blog.51cto.com/9176600/1580076