procmail
[Top] [All Lists]

Re: recipe provided with mutt gnupg how-to

2000-11-27 12:30:41
The mutt/gnupg how-to provides the following recipe to auto-reply with
a text file on receiving a message with the subject, 'send key pub':

:0 h
* ^Subject:[    ]+\/(|send)[    ]+key pub\>.*
| mutt -s "Re: $MATCH" `formail -rtzxTo:` </clau/mykey.asc

I asked for a more elegant way to do this and Collin replied:

    :0 hwi
    * ^Subject:[    ]+\/(|send)[    ]+key pub\>.*
    | (formail -rt; cat /clau/mykey.asc) | $SENDMAIL $SENDMAILFLAGS -t

He rewrote the action, but didn't touch the condition.  Unfortunately,
that's the only part of the recipe I had trouble with.

This is how I interpret the regexp -- please correct me.

A line beginning with 'Subject:', followed by one or more spaces or
tab characters, then zero or one occurrences of the word 'send',
followed by one or more spaces or tab characters, followed by 'key
pub'.

It's been explained to me that the trailing .* causes $MATCH to take
on the value of the entire string (coupled with '\>' to ensure the
match continues past ther end of the word 'pub').  This is left over
from the previous incarnation of this recipe which built a message
with a subject of, 'Re: $MATCH'. 

My major concern is '(|send)' (i read this to mean <nothing> OR 'send').
This doesn't work, though -- the recipe doesn't trigger on a message
with the subject, 'key pub':

Why was this recipe chosen over the more intuitive

* ^Subject:[    ]+\/send key pub\>.*

Since Collin's new recipe doesn't touch $MATCH, why can't this be even
further simplified, to

* ^Subject:[        ]+send key pub

Many thanks,

cory







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