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

Hi,

I'm using Perl (with Taint check) + sendmail for sending email in a CGI script. Part of the script looks like below:
open (SENDMAIL, '|/usr/sbin/sendmail -oi -t') or die "Cannot fork to s +endmail: $!"; print SENDMAIL <<"EOF"; From:<$email> To:<$email2> Errors-To:<$email> Subject: $subject $body EOF close (SENDMAIL);
That works fine for sending emails to valid/working email address.

However when sending to bogus email addresses, I cannot receive any indication (i.e. no email bounced back to $email telling me that the email was undeliverable).

If I use this instead:
open (SENDMAIL, '|/usr/sbin/sendmail -oi -t -OUseErrorsTo=true')
Perl complaints with this error message (without sending emails to both valid/invalid email address):
Can't create transcript file ./xff5DLdxv22364: Permission denied
Any idea about how to use Perl + sendmail to handle bogus email address?? Having the original email bounced back to the $email is my goal

P.S. I'm writing that Perl CGI script for an Apache server on Red Hat Linux 7.0 with Sendmail 8.11. (I DON'T have root access on this server)

Any help is appreciated! Thanks ahead!

Replies are listed 'Best First'.
Re: sendmail in Perl to handle false/bogus/undeliverable email address
by perigeeV (Hermit) on Jun 14, 2001 at 02:30 UTC

    How about lightening up the load on your mail server by checking the validity first. Email::Valid will tell you if the address will even make it out of sendmail.

      I was thinking about that. However I don't even have an account on this web server, so installing a Perl module is not an option (too bad). Thanks for your suggestion though.

        Read this. You can't expect to have the full bastion of modules available on every box. Just set up your own local module library.