Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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>

Justw ant to see how long this takes


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(, trymx=1)

dns_getcanonname: trying (A)

5 second delay here YES


getmxrr([], droplocalhost=1) Connecting to [] via relay...

220 ESMTP Sendmail 8.13.8/8.13.8; Fri, 18 May 2012 06:55:04 +0200

>>> EHLO localhost.localdomain Hello localhost.localdomain [], pleased to meet you








250 HELP

>>> MAIL From:<root@localhost.localdomain> SIZE=115

10 second delay here

250 2.1.0 <root@localhost.localdomain>... Sender ok

>>> RCPT To:<>

>>> DATA

5 second delay here

250 2.1.5 <>... Recipient ok

354 Enter mail, end with "." on a line by itself

>>> .

250 2.0.0 q4I4t4Lu014501 Message accepted for delivery Sent (q4I4t4Lu014501 Message accepted for delivery)

Closing connection to []

>>> QUIT

221 2.0.0 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?

share|improve this question

1 Answer 1

It looks like

  1. Delay to resolve name via DNS
  2. Recipient check by remote SMTP server
  3. Sender check by remote SMTP server

Is the remote server the same as before? Do you have any visibility of that server?

Have you run tcpdump on that interface to see if there is any protocol activity during the gaps? Try this (as root) -

# tcpdump -vvv -w output.pcap -i eth0 'port not 22'

This will capture all traffic except your SSH session traffic and output to the file 'output.pcap'.

I don't suppose there's any chance you've moved to an IP that is on a blacklist somewhere? Sites like the following can help you find out -

share|improve this answer
This is the same across multiple different remote SMTP servers - Gmail, Hotmail, a bunch of university servers, all of them have the same delay on step 2. Also the DNS delay seems to happen no matter what DNS servers I put in (my providers, or ones I have on another server). I have to figure out the tcpdump thing, I'm not very good at sysadminning, I'll look that up, thanks! –  Cocorico May 18 '12 at 5:40
No problem! I'll put a command in the answer for tcpdump. –  Cawflands May 18 '12 at 5:44
Also, it would be interesting to know how quickly 'dig' returns on your server - it's a dns lookup which will use the servers in /etc/resolv.conf. –  Cawflands May 18 '12 at 5:49
109 msec for the thing.. I have used nslookup to look up a bunch of servers and they're all similarly fast. I'll go run the tcpdump stuff and whatnot, thanks! –  Cocorico May 18 '12 at 6:25
Ahh, I am on 6 blacklists. I will look into getting off those, but in the meantime, would that actually slow things down? I mean, I understand it would for some servers, but do you think ALL the servers are checking those lists? Cause it's literally this slow on every single one I sent to - AOL, prodigy, msn, hotmail, etc etc etc. Oh yeah, I actually just tried sending to a server I have somewhere else, and it's slow to that too, and I know it doesn't check any lists. –  Cocorico May 18 '12 at 6:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.