Menu Close

Sendmail is slow

Problem:

The sendmail service takes a while (more than a minute) to start and emails sent via sendmail take a couple of minutes to get delivered:

 

Background & Analysis:

Sendmail uses DNS for the following:

  • At startup, to obtain the canonical name for the local host.
  • To obtain the canonical name of a remote host that connects to the local host.
  • To obtain the address of the the SMTP Relay to which sendmail connects.
  • When sendmail expands $[ and $] in the RHS of a rule.

Refer this article for more details.

Solution:

STEP 1: Ensure that the local host’s canonical name may be looked up by adding the following as the first entry in /etc/hosts:

127.0.0.1       localhost.localdomain <hostname>

where, <hostname> should be replaced by the local host’s hostname.

Restart the sendmail service as shown below:

 sudo service sendmail restart 

Implementation of this step enabled my sendmail process start up very quickly.

 

STEP 2: Ensure that the SMTP Mail Relay is configured to not look up DNS by surrounding the Mail Relay’s address by square brackets in /etc/mail/sendmail.cf as shown in the example below:

DS[10.1.1.10]

Restart the sendmail service as shown below:

 sudo service sendmail restart 

Implementation of this step enabled my sendmail process to deliver emails quickly.

 

Root Cause:

The sendmail process takes a while to do lookups in DNS.

 

(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.

(2) Your rating of this post will be much appreciated as it gives me and others who read this article, an indication of whether this solution has worked for people other than me. Also, feel free to leave comments.

 

VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Print Friendly, PDF & Email
(Visited 401 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *