procmail
[Top] [All Lists]

Re: Serious error!? Procmail supplies filenames in /root as arguments to script

2003-07-14 13:42:15
At 22:15 2003-07-14 +0200, Frode Lillerud did say:

I'm beginning to realize that I need to rewrite the way I use both .procmailrc and my perl-script. Instead of working with $ARGV[] I need to use <STDIN> instead. No more of this environment variable passed as a command line parameter.

You should also realize that as long as you're _TESTING_, you should set up your rcfile to be run under a sandbox, rather than on your live email. See my .sig for a link to a functional sandbox example.

Consider placing the recipe into it's own rcfile, and using INCLUDERC to include that into your ~/.procmailrc, but, for now, COMMENT IT OUT:

#INCLUDERC=baesian_spam.rc

You can turn it back on in your .procmailrc when you've finished testing it on STATIC email, but until then, you can INCLUDERC that rcfile into the sandbox script, which you'd manually invoke.

What I want is to pass the entire message (header + body) to the perlscript,

:0fw
| perlscript.pl

and get it to alter the header.

Read STDIN line by line, appending that to a $HEADER variable, and switch to storing to a $BODY variable after the first blank line. This will make it easier for you to tack on additional header lines.

Dealing with adding headers will require a bit more work - in fact, you should also deal with concatenating continued header lines and you'll probably have to contend with whether you're adding new headers, appending to the content of existing ones, or replacing existing ones (where your header name matches one which is already present).

Possibly use an exitcode in a functionable way.

Well, procmail has a recipe flag for whether the exitcode is paid attention to or not.

Any hints on how I should set up my ~/.procmailrc? And do I need to use formail? Perhaps this -n flags could be usefull.

As I see it, you'd only need to use formail if you were to use it to tack on the headers.

[big snip]
---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail