I've been using the following sendmail code (or similar) in many of my scripts:
#begin code#
my $mail_prog = "/usr/sbin/sendmail";
my $to = $txtnumber;
my $reply_to = $txtnumber;
my $from = $txtnumber;
open (MAIL, "|$mail_prog -t -n -oi");
print MAIL "To: $to <$to>\n";
print MAIL "Reply-to: $reply_to <$reply_to>\n";
print MAIL "From: $from <$from>\n";
print MAIL "Subject: $subject\n";
print MAIL "\n\n";
print MAIL "$message\n";
close(MAIL);
#end code#
It's never been blazing fast, but always got the job done. Just recently however, I noticed things have slowed way down. I have to wait forever just to send one e-mail. If I try to send 3 or 4 e-mails, the browser window will usually time out waiting for the script to finish.
Has anyone experienced anything like this? Can you think of anything that would have caused this sendmail function to slow down so much? When I use Openwebmail on the same server (which also uses sendmail), it sends e-mails very quickly. This leads me to believe that it's not a sendmail problem.
If anyone has any ideas of what's slowing things down, please share them with me. Also, I noticed that many people are using Mail::Send and Mail::Mailer. Do you think these will speed things up? Also, how do Mail::Mailer and Mail::Send compare to each other?
Thanks in advance.
JD
UPDATE: I dug through the maillog file a bit, googled some errors I found, and ended up getting things to work properly. It ended up having nothing to do with Perl. I just had to add a few entries to the /etc/hosts file. Thanks everyone for the help.
Edited by planetscape - added code tags
( keep:0 edit:25 reap:0 )
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.