procmail
[Top] [All Lists]

Re: testing & regexp nonmatch

2001-07-23 13:46:22
Chris Fuchs <chris(_dot_)fuchs(_at_)bchydro(_dot_)bc(_dot_)ca> writes:
1) I've been testing procmail on a file which I received which
isn't being placed in the proper mailbox in the following way:

% procmail < mail_file

and thought it worked this morning on another file I tested.
Now when I do this the file ends up in my spool mailbox appended
to the last message in this file.

Procmail only adds a "From " line to a message if the -d or -f option is
used.  So, if "mail_file" doesn't itself include an initial "From " line,
the content won't be separated from the previous message in the mailbox.

So, you either need to start using the -f option and directly specify the
address to use in the "From " line, or add a recipe to your .procmailrc
that'll use formail to add such a line:

        :0 hfw
        * ! ^From ()
        | formail

The parens are there so you can see the space in "From ".


2) Now for the regexp itself which doesn't match:

This is in the e-mail:
To: "'accu-general(_at_)accu(_dot_)org'" <accu-general(_at_)accu(_dot_)org>

This is the 1st regexp in .procmailrc I tried:
:0:
* ^TO_.*(<)?accu-general(_at_)acc(_dot_)org(>)?
${HOME}/Mail/accu/.


DON'T PUT ".*" AFTER ^TO or ^TO_!!!  They do the skipping for you.


Next: is it acc.org, or accu.org?  (Do you hear you pounding your head
on the table?)


Finally, that last (>)? is pointless because it doesn't have to match.
Perhaps something like "([^-a-z.0-9]|$)" is what you want.

        :0
        * ^TO_accu-general(_at_)accu\(_dot_)org([^-a-z.0-9]|$)
        ${HOME}/Mail/accu/.

I pulled the second colon because dotlocking of MH-style mailbox is
relatively pointless: MH doesn't use those locks and procmail doesn't
have any problems with simultaneous delivery to MH folders.


Philip Guenther
_______________________________________________
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>