procmail
[Top] [All Lists]

passing variables from shell to procmail

2005-10-17 01:48:50
## SHORT VERSION

I need to pass a variable from within a bash script to procmail, but
can't seem to get it to work.  The variable value is always null.

----- bash script extract -----
#!/bin/bash
...
for i in `echo *`; do
  MESSAGE_NO=$i  # I realise this is not needed, could just use $i
  procmail example.procmailrc < $MESSAGE_NO
  mv $MESSAGE_NO.new $MESSAGE_NO
done
...
----- end bash script -----

----- procmail rc extract -----
:0 fw
| spamc

:0:
* ^X-Spam-Level: RR
/dev/null

:0:
$MESSAGE_NO.new
----- end procmail rc -----

How do I get the value of $MESSAGE_NO from the bash script to
procmail?


## LONG VERSION

I am getting a bit adventurous with some bash scripting and procmail
recipes (well, outside *my* comfort zone).  I'll tell you why at the
end of this message, because there'll be some comments about "that's
not what procmail is for!".  I hope I don't offend anyone, the
question is procmail related for sure.

I want to run procmail from within a bash script.  The script will
traverse through various folders, each of which contain potentially
hundreds of files, each of which will be an individual message (read
mail).

Basically I want to use this script/procmail combo as a filter to
act on each file.  For the reasons explained at the end of the
message I can't process the mail on delivery.

And the big surprise purpose of the above?  I'm trying to create a
script for slrnpull, my favourite newsreader's companion, to filter
usenet posts locally on my server.  Mainly for usenet spam etc,
partly for my viewing/reading pleasure.

Why use procmail for the above?  I've had a search on google for
filters/antispam etc for slrnpull but there doesn't appear to be
anything available.  There is "cleanfeed", but that appears to be
for full-blown nntp servers.  There are others too.

Spamassassin may be silly to use for this purpose, may not work at
all, but I will try.

And procmail is much more powerful on header and body searches than
anything I am capable of.

Comments?

-- 
Troy Piggins
Compiled from src: vim 6.4; mutt 1.5.10i; postfix 2.2.4;
                   slrn 0.9.8.1/rt (score_color patch)
RedHat 9 rpms    : kernel 2.4.20-31.9; procmail 3.22

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>