Re: [SLUG] procmail guru anyone?

2008-08-25 Thread Luke Vanderfluit

Hi Nigel.

You could post to the (very active) procmail mailing list.
I did some procmail stuff years ago and my experience with the help on that list was very 
good!


hth.

Kr.
Luke.

Nigel Allen wrote:


Hi

I'm struggling with procmail - as a complete newbie I should add.

Basically the pseudo code for what I want is as follows:

extract string from header.

if length($string) < 6
  pad $string left spaces to 6;
if test -d $string
  file the email into the folder $string
else
  forward to bad_folders alias;

What I have so far is:

:0
* ^X-My-Header:[ \t]*\/$
{
  STRING=${MATCH}
  :0
  * ? test ! -d $MATCH
  {
 ! bad_folder
  }
  $MATCH
}

I've managed to fudge my way so far with lot's of help from the Search 
Engine Gods, but I'm stuck on the "pad" problem. I know I could write 
this as a shell script or a perl snippet and then pipe the value of the 
variable out to it but how do I get it back in again (or alternatively 
how do I do it within procmail?


TIA

Nigel




--
Luke Vanderfluit
Analyst / Web Programmer
e3Learning.com.au
08 8221 6422
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] procmail guru anyone?

2008-08-25 Thread Nigel Allen


Hi

I'm struggling with procmail - as a complete newbie I should add.

Basically the pseudo code for what I want is as follows:

extract string from header.

if length($string) < 6
  pad $string left spaces to 6;
if test -d $string
  file the email into the folder $string
else
  forward to bad_folders alias;

What I have so far is:

:0
* ^X-My-Header:[ \t]*\/$
{
  STRING=${MATCH}
  :0
  * ? test ! -d $MATCH
  {
 ! bad_folder
  }
  $MATCH
}

I've managed to fudge my way so far with lot's of help from the Search 
Engine Gods, but I'm stuck on the "pad" problem. I know I could write 
this as a shell script or a perl snippet and then pipe the value of the 
variable out to it but how do I get it back in again (or alternatively 
how do I do it within procmail?


TIA

Nigel

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html