procmail
[Top] [All Lists]

Re: Outgoing filter?

1996-08-08 22:51:37

At 09:14 pm 8/8/96 -0700, Alan Stebbens <stebbens(_at_)sgi(_dot_)com> spake:
If your MUA is not so flexible, then you should see if your MTA is
configurable.  Most Unix system's support sendmail which is very
configurable, albeit obscurely.  It is not too difficult to modify
sendmail.cf to insert rewrite rules for outgoing addresses such that the
mail is filtered before being sent.  See the procmail distribution
"examples" directory for hints.

   I'm using sendmail 8.6.12 and I have procmail installed as my MDA 
in place of deliver. I have procmail installed according to the 
instructions (and I know it's working, because my .procmailrc file 
is working without a .forward). It's running on a Linux box. I use 
Eudora on my PC to write my mail, and it sends it to my Linux box 
with SMTP (sendmail). So, given that configuration, how do I get 
procmail to intercept the outgoing messages so I can process them? 

You covered the _incoming_ side of the transport process, but not
the _outgoing_ side.

The delivery is controlled by the "Mlocal" definition; the outgoing
transport filtering is controlled by special rules in the Mtcp, Muucp,
or Mether definition (whatever outgoing mailer is used in yoiur
config).

As I said before, see the examples, especially in the procmail(1) man
page; the four paragraphs below are straight from the manual:

  procmail(1):

       The -m option is typically used when  procmail  is  called
       be able to do this it is convenient  to  create  an  extra
       `procmail' mailer in your sendmail.cf file (in addition to
       the perhaps already present `local' mailer that starts  up
       procmail).  To create such a `procmail' mailer I'd suggest
       something like:

              Mprocmail, P=/usr/local/bin/procmail, F=mSDFMhun, S=11, R=21,
                      A=procmail -m $h $g $u

       This enables you to use rules  like  the  following  (most
       likely  in  ruleset 0) to filter mail through the procmail
       mailer (please note the leading tab to continue the  rule,
       and the tab to separate the comments):

              R$*<@some.where>$*
                      $#procmail $@/etc/procmailrcs/some.rc 
$:$1(_at_)some(_dot_)where(_dot_)procmail$2
              R$*<@$*.procmail>$*
                      $1<@$2>$3       Already filtered, map back


Of course, you have to figure out where and how to trigger the rewrite
rule to invoke the "some.rc" filter file.  The example above triggers
based on the domain of "some.where"; you could, instead, have it 
trigger on a particular set of users (logins).

Just be sure to avoid looping.

G'luck.
_____________________________________________________________________
Alan Stebbens           <stebbens(_at_)sgi(_dot_)com>             (415) 933-6437
Digital TV, Silicon Interactive Group,  Silicon Graphics, Inc.  (SGI)
M/S:9L991,     2011 N. Shoreline Blvd.,     Mountain View, CA   94043
PGP Key Fingerprint: 94 A7 4B AB 1C F0 4D 92  DD BC B5 D7 11 A0 DC B3

<Prev in Thread] Current Thread [Next in Thread>