myfile=`cat /var/block`
If you want to do that you're almost always doing some sort of rudimentary access list or spam filtering in which case you better look at Spamassassin unless constant reinvention of wheel is your thing. Anyway. Here's an extremely simplified example to do filtering based on email addresses. Start by echoing email addresses into a list (use some test addresses if you're gonna do this for real, OK):
Code:
]$ echo "emai@addre.ss > ~/.procmail/allowlist"
]$ echo "em@aiad.dress >> ~/.procmail/allowlist"
Now edit the global or personal procmailrc to add logging to troubleshoot / check recipes:
Code:
VERBOSE=on
DROPPRIVS=yes
LOGABSTRACT=all
LOGFILE=~/.procmail/logfile
Now add the recipe:
Code:
# Recipe: route email to named mailbox "~/mail/allow"
:0
* ? (formail -x From: | fgrep -iqf ~/.procmail/allowlist)
~/mail/allow
Done, save, quit. Test.
Please read the procmail and grep man pages for more info.