procmail
[Top] [All Lists]

I don't get it ...

2001-03-01 05:01:31
Okay, so it's me, I admit it.  Maybe it's because I mastered playing 
the harpsichord at 3, studied calculus at 5 and became a Nuclear 
Astro Physicist at 12 that I have not had a life and am now messing 
around with procmail recipes - I don't know!
I would much rather be writing recipes for Portuguese Piri-piri 
prawns (I'm told I cook up a tasy morsel), but that does not solve 
my present dilemma.
Oh regex guru, I implore you, explain to me the mysteries of the 
arsee! (much bowing and scraping follows).

SNAP OUT OF IT !!

Okay, those of you that I have not yet offended, please give me a 
hand with this.  I have a client who insists on using a single mail 
account for all incoming mail and wants me to distribute it to the 
correct boxes when it lands.
I have done this, and all is well, but for the mails with the strange 
characters in their To: header which create really wierd mail folders.
here is the recipe I currently use (and it works):
:0:
* ^TO_\/(.*)@
* MATCH ?? ()\/[^(_at_)]+
$MATCH

If mail is received that has a "To:" header such as "<name>", I get a 
mail folder called "<name>" and the recipient does not receive the 
mail.

I tried this to strip invalid characters:
:0:
* ^TO_\/([a-z0-9.-]+)@
* MATCH ?? ()\/[^(_at_)]+
$MATCH
Thinking that only alpha-numerics and . and - would get in
WRONG !
So I tried to be smart (the NA Physicist personality kicked in ...)
:0:
* ^TO_\/(.*)@
{
  # Get rid of anything that is not alphanumeric or a dot
  NAME="echo $MATCH | sed 's/[^a-zA-Z0-9\.//g'"
  # And plonk it into a folder of that name
  :0:
  $NAME
}

WRONG AGAIN !! - procmail told me off:

procmail: Extraneous locallockfile ignored
procmail: Skipped "<fm*@ | sed 's/[^a-zA-Z0-9\.//g'"

Okay - so I humbly beseech thee guru, show me the error of my 
ways ....
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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