Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delay when calling sendmail from within script

Status
Not open for further replies.

cawthor

Programmer
May 31, 2001
89
US
Hi,

I don't know if this is a sendmail or code issue so I will post this question in both forums.

I am trying to send an email from within a perl scrip by calling sendmail, code is below:

$mailprog = '/usr/sbin/sendmail';

open(SENDMAIL, "|$mailprog -t ");
print SENDMAIL "Reply-to: $sender_email\n";
print SENDMAIL "From: $sender_email\n";
print SENDMAIL "Subject: Test\n";
print SENDMAIL "To: me\@anywhere.com\n\n";
print SENDMAIL "$message\n";
close(SENDMAIL);

The problem is that this code takes about a minute to run. If I include this in a loop, then the code takes a minute for each iteration of the loop (ie. each sendmail call). I receive the item once the code has been processed, there is just a long delay to send the item. If I call sendmail from the command line then there is no delay, and I receive the item immediately. I also experience the same delay when calling sendmail from within PHP. Any help would be appreciated.

Thanks...
Rich.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top