in reply to Sending looped emails
There is another thing. You should check the return value of the open() and close(). If you don't you do not notice if something goes wrong and you fail to start the sendmail or it reports a problem.
open( MAIL, "| $sendmail -t" ) or die "Can't start $sendmail : $!\n"; print MAIL "To: $_"; print MAIL "From: $adminmail"; print MAIL "Subject: $subject\n\n"; print MAIL "$message"; print MAIL "."; close(MAIL) or die "Failed to send the mail: $! $?\n";
Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
Edit by castaway: Closed small tag in signature
|
|---|