This was another issue happened several days ago.
In our email configuration, there was one central email server to sent email out and all other servers transferred email to this central email server, and this issue happened on one of the client servers.
When I run mail command to send test email, all the emails were placed in the defer queue after about 5 minutes, and after several days they would be transferred to the central email server.
I am not an email expert and only know a little of sendmail, so I guessed this issue was caused by DNS lookup, and I learnt that I could update the
so the sendmail will not try to get the MX record of the relay servername, but failed.
I updated the servername to the ip address and failed also.
I could not find such issue on other servers while I found the sendmail client queue would be checked per hour, so I updated the sendmail sysconfig file /etc/sysconfig/sendmail
cat /etc/sysconfig/sendmail DAEMON=yes QUEUE= SMQUEUE=p30s
But still failed.
From the output of mailq, I noticed the error message:
host map: lookup (domain.com): deferred
And the domain.com was the domain name of the recipients, so the local sendmail service tried to lookup the domain name of the recipients first, then would transfer them to the relay server, but I just wanted it to transfer them as soon as I finish my input.
Based on the above analysis, I wanted to disable DNS lookup of the local sendmail, and got below sendmail parameter:
And in this file, only one line:
cat service.switch hosts files
So the local sendmail would only lookup hostanme through the /etc/hosts file.
After such change, I regenerated the sendmail cf files and restarted it, and it did work well.