I have a perl script that sends mail out to a mailing list.
On my old dedicated server, it worked fine, and sent one email per second basically. I recently switched to a new dedicated server, with about the same specs, and it's going extremely slow, about one mail every 30 seconds. I set up a test script to watch what part takes the longest:
open(MAIL,"| /usr/sbin/sendmail -tv -d8.7 $recipient_email");
print MAIL <<EOF;
From:Test Sender <$sender>
To:$recipient_email
Subject:Testing
Justw ant to see how long this takes
EOF
close(MAIL);
The -d8.7 there is a debug option that lets me watch the output of the script. I will paste that here, there are 3 spots which both hang for too long, I will mark them here:
dns_getcanonname(receiving_server.com, trymx=1)
dns_getcanonname: trying receiving_server.com. (A)
5 second delay here YES
dns_getcanonname: receiving_server.com
getmxrr([127.0.0.1], droplocalhost=1)
andrew@receiving_server.com... Connecting to [127.0.0.1] via relay...
220 my_server.com ESMTP Sendmail 8.13.8/8.13.8; Fri, 18 May 2012 06:55:04 +0200
>>> EHLO localhost.localdomain
250-my_server.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-DELIVERBY
250 HELP
>>> MAIL From:<[email protected]> SIZE=115
10 second delay here
250 2.1.0 <[email protected]>... Sender ok
>>> RCPT To:<andrew@receiving_server.com>
>>> DATA
5 second delay here
250 2.1.5 <andrew@receiving_server.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 q4I4t4Lu014501 Message accepted for delivery
andrew@receiving_server.com... Sent (q4I4t4Lu014501 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 my_server.com closing connection
As far as I can tell, my /etc/hosts and /etc/resolv.conf seem fine, and these are the only things that Google suggests might be broken, anyone have any ideas?