Stegalex has asked for the wisdom of the Perl Monks concerning the following question:

I am using some pretty basic code to automate the sending of customer service emails. The problem I am having is that the enlosed call to sendmail hangs for a really long time when I send messages to addresses ending in 'hotmail.com'. Everyone else gets their mail lickety-split. Vexing. Here's the code. Any suggestions would be appreciated. Thanks.
open (MAIL,"|/usr/lib/sendmail -oi -t") or die "can't fork sendmail: $!"; print MAIL $mailvar or die "\nCan not print to MAIL\n"; close(MAIL) or die "\nCan not close MAIL\n";

Replies are listed 'Best First'.
Re: sending mail to hotmail.com
by lshatzer (Friar) on Jul 06, 2001 at 22:08 UTC
    Since you are using /usr/lib/sendmail, I assume you are using qmail. If you are, you might want to look at http://web.infoave.net/~dsill/lwq.html#DNS-problem

    If your /var/log/syslog is reporting this error in each case:

    deferral: CNAME_lookup_failed_temporarily._(#4.4.3)

    Then you have the problem. This exists primarily with large email provider addresses such as hotmail.com and msn.com. More explinations in the URL above.

Re: sending mail to hotmail.com
by tachyon (Chancellor) on Jul 06, 2001 at 22:13 UTC

    I am not a unix/sendmail guru but as I understand it what happens with the modifiers that you are using with sendmail is that it *waits* for a response from the recipient server *before* processing the next email. As hotmail is so overloaded and slow this is possibly the problem. If you add the -odq modifier to your cmd line flags to sendmail your emails will be placed "on delivery queue" - in other words sendmail spools them. *Warning* the -odq option needs to be configured. If your sendmail is not configured to use it your emails will sit around forever! There is a short delay associated with this spooling, no doubt configurable and dependent on server load but also out of my area.

    Hope this helps

    open (MAIL,"|/usr/lib/sendmail -oi -t -odq") 
    

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: sending mail to hotmail.com
by arhuman (Vicar) on Jul 06, 2001 at 21:56 UTC
    You'd better check your sendmail logs...
    You'll probably find a kind of timeout there...

    My first guess is a kind of 'ping check' on the host your trying to send a mail to, and as hotmail.com doesn't respond to ping...
    (But of course with no elements it's only a guess...)

    "Only Bad Coders Code Badly In Perl" (OBC2BIP)