procmail
[Top] [All Lists]

Re: I don't get it ...

2001-03-01 12:23:58
Eugene Geldenhuys wrote:

[...]

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.

... which has often been discussed on this list as being a bad idea.

Nonetheless,

[...]
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 !

What happens?  What does a logfile with VERBOSE=YES show, and
for what kind of input?  It "works" for me, but I'm only
guessing at the "To:" line which gives trouble.

(Your procmail is new enough to recognize "^TO_", I presume?
What version?)

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'"

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

This is your current trouble... you want something like:

  NAME=`echo $MATCH | sed 's/[^a-zA-Z0-9.]//g'`

Note three changes:
        backticks rather than double quotes
        closing ] missing in sed command
        don't use "\" to escape the "." in character class

However, I still don't thinks this does what you want, but I confess
that it's not clear to me exactly what you do want.

Stan
_______________________________________________
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>