procmail
[Top] [All Lists]

Re: Abuse

1999-08-22 07:22:33
On Sat, 21 Aug 1999 14:30:35 -0400 (EDT), "Administrator - Henry Smith
Jr. " <hensj(_at_)seth(_dot_)ihs2000(_dot_)com> wrote:
SENDMAIL=/usr/sbin/sendmail

(Don't muck with SENDMAIL unless you know it's wrong, in which case
recompile your Procmail if you can.)

FORMAIL=/usr/bin/formail

(If you user explicit calls to formail anyhow, this doesn't do
anything.)

:0:
* !^From.*purplecav
* !^FROM_DAEMON 
* ^(From:).*(myaddress(_at_)ihs2000\(_dot_)com)
| /usr/bin/formail >> /usr/home/purplecav/myaddress.log \
     | (formail -r -t ; cat /usr/home/purplecav/abusemessage.txt) \
     | $SENDMAIL -i -t << /usr/home/purplecav/myaddress.txt

:0:
| /usr/bin/formail >> /var/mail/$USER

All these calls to formail seem superfluous. I'm only guessing here,
but this could perhaps be closer to what you want.

The first recipe has to be split in two; you can never say
foo >>bar | baz in Unix because you have to choose between redirecting
(> or >>) and piping (|) and can't have both.

    :0
    * ! ^From(.*\<)?purplecav
    * ! ^FROM_DAEMON
    * ^From:(.*\<)?myaddress(_at_)ihs2000\(_dot_)com
    {
        :0hc:  # saves headers only to log
        /usr/home/purplecav/myaddress.log

        :0c
        | ( formail -rt -I "Precedence: bulk" \
                    -I "From: postmaster <nobody(_at_)ihs2000(_dot_)com>" ;
            cat /usr/home/purplecav/abusemessage.txt ) \
          | $SENDMAIL -oi -t  # or $SENDMAIL -oi 
myaddress(_at_)ihs2000(_dot_)com

        # I'm guessing this should go under the common condition as well
        :0:
        /var/mail/$USER
    }

What is USER set to, and how? Perhaps you mean $LOGNAME?

The saving to /var/mail/${LOGNAME:-$USER} is perhaps completely
superfluous if this is being invoked from this user's .forward file or
your site-wide /etc/procmailrc as part of the normal delivery, as the
message will be saved to $DEFAULT by Procmail eventually anyway (and
you might want to give your user the option to save it elsewhere).

$cat myaddress.txt

To: myaddress(_at_)ihs2000(_dot_)com
From: Postmaster <nobody(_at_)ihs2000(_dot_)com>
Subject: Notice
Reply-To: nobody(_at_)ihs2000(_dot_)com

If you want formail -rt to figure out where to send the reply, you
can't override what it produces by putting in a new To: header. (You
also can't mix pipes with input redirection; or rather foo | bar < baz
will cause the output from foo to go straight to the bit bucket.) If
you temporarily want to send mail to myaddress(_at_)ihs2000(_dot_)com you can
replace the -t to the call to Sendmail with this address, and then
change that back to -t when you are comfortable with the other parts
of this recipe.

The Reply-To: should be unnecessary and I think changing the Subject
is a bad idea. Possibly you can do something like

    :0
    * ^Subject:[        ]*\/[^  ].*
    { SUBJECT=$MATCH }

at some stage and then add this to the call to formail:

                -I "Subject: (Automatic notification) Re: $SUBJECT"

whereby you preserve the old Subject if there is one ... it would be
desirable to get only one Re: and so not add one if one was already
present, but that's a different can of worms (and you will find some
solutions to that in the archives as well).

(See earlier threads for some variations. This was discussed on the
list recently. You can maybe glean some tips from the previous rehash:
<http://www.xray.mpe.mpg.de/mailing-lists/procmail/1999-07/msg00163.html>
and look at the replies.)

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

<Prev in Thread] Current Thread [Next in Thread>
  • Abuse, Administrator - Henry Smith Jr.
    • Re: Abuse, era eriksson <=