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

How do I call sendmail so that bounced mail is ignored? As is my script (code follows) returns bounced messages to the username the script is run under, i.e., me. I'd prefer to stick them somewhere in a flat file or ignore them instead of cluttering my personal inbox. I've looked into some sendmail flags, but things like -oeq don't seem to work. Thanks

~evan

Replies are listed 'Best First'.
Re: sendmail and bounced mail
by fokat (Deacon) on Jun 15, 2003 at 00:10 UTC

    The standard way to achieve this, is to add a header such as...

    Errors-To: nobody@some.where.far.far.far.away
    

    Where the email address you supply, should be a blackhole. Many sites maintain a nobody@site address for that purpose. Ask your friendly postmaster about this.

    By looking at your sample code, you might also want to add a header such as...

    Reply-To: nobody@site
    

    Best regards

    -lem, but some call me fokat

Re: sendmail and bounced mail
by sgifford (Prior) on Jun 15, 2003 at 20:30 UTC

    You want to use sendmail's -f flag. That will specify the email address where bounced mail should be returned to. If you want bounces to go into a flat file, set up an alias for that address to go to a flat file.

    If you want to discard bounces, set up an alias for that address to go to /dev/null. You can also use -f '' to ask the mail system not to generate bounces at all.