"Timothy J. Luoma" <luomat(_at_)cedman(_dot_)remote(_dot_)Princeton(_dot_)EDU>
writes:
I saw it but didn't realize it was answering this question... I still
don't grasp it entirely.
You quoted this:
:0
*^TOsome-mailing-list(_at_)somewhere
*^Subject:.*(a subject|another interesting subject or maybe a|keyword)
!
someone-else-who-should-subscribe-themselves-to-the-list(_at_)another(_dot_)site
Would that mean that if my procmailrc had something like this:
:0
*^Subject.*URGENT
! 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu
That would work. You should probably include the colon in the
regexp matching the Subject: header. Otherwise, this would match
a hypothetical "Subject-before-censoring:" header. I also must
strongly suggest that you be liberal with whitespace (spaces and tabs).
Additional whitespace makes procmail recipies much more readable by
adding immeadiate visual distinction to conditions as opposed to actions
or the initial recipe start line.
:0
* ^Subject:.*URGENT
! 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu
You should also be aware that by default procmail is case-insensitive.
This means that the above recipe will match a subject containing "uRgeNt",
or "urgent" or... If you want to require that "URGENT" be in uppercase,
you have to use the "D" flag on that recipe. Recipe flags are placed
after the '0' in the initial ":0" line of the recipe:
:0 D
* ^Subject:.*URGENT
! 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu
would mean that any message which had the SUBJECT of URGENT would be
forwarded to 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu? Can these be strung
together so
the last line might look like this:
! 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu, username(_at_)somewhere(_dot_)ext
and the message would be forwarded to two people?
Actually, you should leave the comma out:
:0 D
* ^Subject:.*URGENT
! 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu username(_at_)somewhere(_dot_)ext
or
! 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu, somemailbox
so the message would be both forwarded and filed in 'somemailbox' ?
This won't work. If you want to do two different types of actions
(forwarding and filing into a mailbox), you need to use two recipes.
Golly gee, this is the second example on the procmailex manpage!
(I'm not trying to be snide. I just think you need to start looking
at the spirit of the examples on the manpage, and not get so tied up
in the specifics. When the manpage says:
Forward all mail from peter about compilers to william (and
keep a copy of it here in petcompil).
:0
* ^From.*peter
* ^Subject:.*compilers
{
:0 c
! william(_at_)somewhere(_dot_)edu
:0
petcompil
}
you should try matching what the sentence says to what the recipe
contains. The "from peter about compilers" appears to correspond
with the recipe conditions
* ^From.*peter
* ^Subject:.*compilers
while the "forward ... to william" is the
:0 c
! william(_at_)somewhere(_dot_)edu
sub-recipe, and "keep a copy of it in petcompil" is the
:0
petcompil
sub-recipe. If you then state what you want to do in a format
similar to example sentence, the recipe should be relatively
obvious:
Forward all mail with URGENT in the subject to
476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu and
username(_at_)somewhere(_dot_)ext (and
keep a copy of it here in somemailbox).
:0 D
* ^Subject:.*URGENT
{
:0 c
! 476tjl(_at_)ptsmail(_dot_)ptsem(_dot_)edu
username(_at_)somewhere(_dot_)ext
:0
somemailbox
}
Ta da!
Philip Guenther
----------------------------------------------------------------
Philip Guenther UNIX Systems and Network Administrator
Internet: guenther(_at_)gac(_dot_)edu Phonenet: (507) 933-7596
Gustavus Adolphus College St. Peter, MN 56082-1498
I am _not_ a representative sample of the Gustavus Community. Yeah, right...
Source code never lies (it just misleads). (Programming by Purloined Letter?)