At 03:31 2002-07-06 -0700, piyush shah wrote:
Can someone tell me where should i put the regular
expression so the procmail parses it and delivers to a
script directly or to a person and than to a script.
You need to be clear on how it is you think that procmail is going to be
handed this email. If you have a virtual domain, and the domain is
wildcarded to a local user, then that user's ~/.procmailrc is where the
procmail filter would go. Or, you could put it within a user-specific
/etc/procmailrc construct.
Using procmailrc as an MTA-invoked rule is something very few people do,
due to the complexity of the MTA rulesets.
Next, is the recipient cleartexed (actually appears in the To: field), or
are they sometimes BCC'd?
Assuming you put it in the users ~/.procmailrc:
:0
* ^To:.*\<forum_[0-9]+(_at_)somewhere\(_dot_)com\>
{
# the c copies it
:0c
! someone(_at_)somewhere(_dot_)com
# the i says "ignore possible write errors" - if your script
# doesn't read every byte of the message, procmail will treat
# it as an error.
:0i
| yourscript
}
Such forwarding assumes that the forwarded user won't process mail through
the SAME filter, else the construct will match again, and a loop will occur.
This will help guard against such an event:
:0
* ^To:.*\<forum_[0-9]+(_at_)somewhere\(_dot_)com\>
* ! ^X-Loop: someone(_at_)somewhere\(_dot_)com
{
# the c copies it
:0c
| formail -A "X-Loop: someone(_at_)somewhere(_dot_)com" | $SENDMAIL
someone(_at_)somewhere(_dot_)com
# the i says "ignore possible write errors" - if your script
# doesn't read every byte of the message, procmail will treat
# it as an error.
:0i
| yourscript
}
(the $SENDMAIL bit is the procmail-determined MTA invocation, fret not that
you have postfix)
Also is it necessary to create procmailrc file , as i
do not have one now.
It is necessary to create a file to put the filter in, yes. Either it's a
.procmailrc in the user dir, or /etc/procmailrc for all users, or you're
invoking procmail from an MTA ruleset and specifying some file (in which
case it doesn't have to have any certain name), or you're invoking it from
an MTA alias definition as a program mailer, and again, you need an rcfile,
but there isn't a specific name you have to use.
You should check the procmail homepage and the link to Jari's Procmail
resources as well as Nancy's QuickStart.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail