Linux – sendmail is timing out

centoslinuxsendmail

sendmail is timing out on one of our CentOS servers. Here is my test

[root@testserver ~]# echo "Subject: test" | /usr/lib/sendmail -v john@ourdomain.com

Here is the output:

john@ourdomain.com... Connecting to [127.0.0.1] via relay...
220 testserver.ourdomain.com ESMTP Sendmail 8.13.8/8.13.8; Thu, 23 Jun 2011 14:32:18 -0600
>>> EHLO testserver.ourdomain.com
250-testserver.ourdomain.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<root@testserver.ourdomain.com> SIZE=14 AUTH=root@testserver.ourdomain.com
250 2.1.0 <root@testserver.ourdomain.com>... Sender ok
>>> RCPT To:<john@ourdomain.com>
>>> DATA
250 2.1.5 <john@ourdomain.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 p5NKWInQ008636 Message accepted for delivery
john@ourdomain.com... Sent (p5NKWInQ008636 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 testserver.ourdomain.com closing connection

And then a minute later, /var/log/maillog shows the following:

Jun 23 14:32:18 testserver sendmail[8635]: p5NKWICR008635: to=john@ourdomain.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30014, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p5NKWInQ008636 Message accepted for delivery)
Jun 23 14:33:00 testserver sendmail[8638]: p5NKWInQ008636: to=<john@ourdomain.com>, ctladdr=<root@testserver.ourdomain.com> (0/0), delay=00:00:42, xdelay=00:00:42, mailer=esmtp, pri=120313, relay=ourdomain.com. [173.201.XXX.XXX], dsn=4.0.0, stat=Deferred: Connection timed out with ourdomain.com.

In that second log entry, it appears to be trying to use our external company website to try to relay the email… I have no idea why its trying to do that. Another it guy setup this server recently so I'm not sure if he changed the sendmail configuration or what. Where should I be looking to remedy this?

(obviously names, domain names and IP addresses have been changed in the above logs to protect the innocent)

Best Answer

Sending a mail message externally on a host using sendmail is now a two step process. The first step basically sends the email locally for queueing to be sent externally. The next step in the process takes the queued message and sends it out to the appropriate place. If no destination routing information or smarthost information is configured, sendmail consults the DNS finding the MX records for that domain and uses one of the possibly many hostnames returned to send the mail to. This all looks normal to me, especially if the external MX host is not accessible to you.

Do you want this host to send mail externally, or just forward it to a central location? If all you want to do is the latter, a sendmail configuration file can be generated such that all email sent from your host is forwarded to another host for transmission. This is usually necessary in large companies, like mine, to restrict users from possibly bombing the net with bogus email due to virus.

Related Topic