[prev in list] [next in list] [prev in thread] [next in thread] 

List:       procmail
Subject:    Re: Return to sender recipe?
From:       <jari.aalto () poboxes ! com> (Jari Aalto+list ! procmail)
Date:       1998-08-28 9:28:23
[Download RAW message or body]

|Thu 1998-08-27 Lynn McDougal <sneezy@darkwing.uoregon.edu> list.procmail
| Greetings...
| 
| Anyone out there have a short recipe (or long if needed) that will allow a
| filter to occur such that if a known sender's address is in the header, it
| will be rejected and returned to sender?

It's basic procmail...

    :0
    * match-the-header-for-that-mail
    {
        .. do something about that mail
    }

Rejection is done with variable EXITCODE. See manpages or
ftp://cs.uta.fi/pub/ssjaaa/pm-tips.html#list_of_exit_codes

I include my private procmail kill file for reference if you
want to build your own based on it. 

jari


["pm-mykill.rc" (text/plain)]

#  @(#) pm-mykill.rc -- Procmail: Kill and return all idiotic messages
#  @(#) $Id: pm-mykill.rc,v 1.3 1998/08/28 09:20:59 jaalto Exp $
#
#   File id
#
#       $Contactid: <jari.aalto@poboxes.com> $
#       Category  : "my", a personal procmail recipe that is not part of
#                   my procmail modules pm-code.shar
#
#   Description
#
#       Some idiot advertisers don't know when they should stop. These guys
#       keep sending me (many) messages every day. I could tolerate message
#       here and there and be catched by my UBE filter, but from spammer that
#       is particularly enthusiastic, I want to send the message back.
#
#       This procmail modules acts as "kill file", a term known to Usenet
#       news readers. It's a file that deletes articles so that you don't
#       ever see them when you read the group.
#
#       In procmail, kill file means that
#
#       o   You either dump the message to /dev/null
#       o   You return the message back. Perhaps the address is forged
#           if that's from spammer, but at least it wakes up some
#           postmaster in the sending area.
#
#       Requirements
#
#       o   You must have included pm-javar.rc before this module
#           to get definitions of common variables `FORMAIL' `EX_NOPERM'
#           etc.
#       o   `VALID_BODY' is regexp to say "This is ok message"
#       o   `BIFF' is file where to send a brief note that message was killed.
#
#       Make sure you apply this module _AFTER_ filing your work, private,
#       daemon, mailing list, vacation etc. messages. It should be almost
#       last in your .procmailrc.
#
#       Use it with
#
#           RC_KILL     = $PMSRC/pm-mykill.rc
#
#           ...other recipes..
#
#           INCLUDERC   = $RC_KILL
#
#   Change Log: (none)

# ....................................................... code start ...

dummy = " (pm-mykill.rc) -- procmail KILL recipe start."

#       Keep separate Kill file procmail log. Redirect current log file

MyKillSaved = $LOGFILE
LOGFILE     = $HOME/tmp/pm-kill.log

#       This is defined prior including modele.

VALID_BODY  = ${VALID_BODY:-"--Procmail-FIll-This--In--"}
BIFF        = ${BIFF:-"/dev/null"}

kill    # Clear this flag. It will be set if message should be killed.

# .................................................. spam by headers ...

#   From: 11268030@msn.com
#   Subject: ALERT - Internet Fraud and Spying
#
#   X-From-Line: global37@yahoo.com
#   To: Friend@public.com
#   Subject: The Internet Success ToolBox
#
#   To: ed_faulk@yahoo.com
#   Subject: XXX Pics - Passwords & Backdoors NO

:0
*   ()\/(russb@discover-net.net\
    |Subject: ALERT - Internet Fraud\
    |Subject:.*Dental\
    |^From:.*(golf|ballman)\
    |^To: carpediem@usa.net\
    |global39@yahoo.com\
    |ed_faulk@yahoo.com\
    ).*
*$ ! B ?? $VALID_BODY
{
    kill  = "yes"
    match = $MATCH
}

# ..................................................... spam by body ...

# EMAIL MARKETING WORKS!!
#
# Bull's Eye Gold is the PREMIER email address collection tool.

:0 E
* B ?? ^EMAIL MARKETING WORKS
{
    kill = "yes"
}

# ...................................................... Handle kill ...

:0
*    kill ?? yes
* ! ^FROM_DAEMON
{
    :0 hw                           # Get the name where msg is  returned
    TO=|$FORMAIL -rt -zxTo:

    :0 hwic:
    | echo "  [exitcode $to; $MATCH]" >> $BIFF

    EXITCODE = $EX_NOPERM           # Send "Permission denied"
    HOST                            # That's it. Stop procmail immediately
}

dummy = " (pm-mykill.rc) -- procmail KILL recipe end."

LOGFILE = $MyKillSaved              # restore redirected log file

# pm-mykill.rc ends here


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic