abbruch.pl

abbruch.pl - command line utility 

abbruch.pl is a commandline utility for generating .procmailrc files from a set of input files.
Right now it is relatively simplistic as I needed a better way of deailing with spam and still letting my friends and family contact me via email.   (traditional filters weren't working... and I didn't want to mess with the internals of procmailrc. Plus I wanted an easy way to identify and change only logical groupings of email addresses and how i deal with them...

usage:
abbruch.pl > .procmailrc
abbruch.pl will scan the current directory for "99abbruch. LISTNAME.LISTTYPE"
where:
99 indicates a sequence number,
abbruch is a literal part of the file name
LISTNAME is a user readable name for the list that logically ties it's information together
LISTTYPE is one of allow, deny, folder, or special

allow, deny, and folder lists have the following internal file format:
X YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
where X can be either U or D
and YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY is a bunch of user entered text
U will mean the entry is another email address, not to be tweaked when output
   conceptually maps to "BLOCK/ALLOW USER"
 
D The user entered text here is for a domain name.
   it must not have an @ sign in it , the resulting entry in  .procmailrc will be
 .*@YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY

99abbruch.spam.special    
99abbruch.unknown.special
Any .specials are copied verbatim into the procmail file...
For my warped way of viewing the world I want to do these last.

Items in "allow" lists will be output to "|"
Example: the input file is : 01abbruch.Family.allow
U mom@home.net
U dad@home.net
D mysiblings.net
Will result in the following rule in .procmailrc
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 01abbruch allowing email from list Family
:0 H
* ^From.*(\
mom@home.net\
|dad@home.net\
|.*@mysiblings.net\
)
|
Example: the input file is : 02abbruch.Enemies.deny
U jerk@trusted-domain.net
D spam-domain.spam
Will result in the following rule in .procmailrc
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 02abbruchs Denying from list Enemies
:0 H
* ^From.*(\
jerk@trusted-domain.net\
|.*@spam-domain.net\
)
/dev/null
Items folders are output to a folder in the root directory by the same name as the list
Example: the input file is : 03abbruch.Friends.allow
U carl@simpsons-fake-address.springfield
U lenny@simpsons-fake-address.springfield
D nuclear-plant.shelbyville
Will result in the following rule in .procmailrc
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 03abbruch moving email from list Friends to it's own folder
:0 H
* ^From.*(\
carl@simpsons-fake-address.springfield\
|lenny@simpsons-fake-address.springfield\
|.*@nuclear-plant.shelbyville\
)
Friends