procmail
[Top] [All Lists]

Re: Extracting envelope to

1997-10-01 15:01:25
Geoff Mulligan <geoff(_at_)mulligan(_dot_)com> writes:
What I'm trying to do is have procmail process all mail sent to 
someuser(_at_)*(_dot_)foo(_dot_)com

What procmail would then do is lookup where the mail is actually supposed to 
go and forward it as appropriate.

I can't just use the virtualuser facility in sendmail 8 because the true 
destination mailbox is stored separately.

I can run procmail as the local delivery agent if necessary, but I'd like to 
figure out how to add a rule to my sendmail.cf such that all mail sent to 
anyuser(_at_)anyhost(_dot_)foo(_dot_)com would be passed on to procmail with 
the actual user as
a parameter to procmail.

I've tried adding a new mailer Mprocmail as suggested in the man pages and a 
rule to ruleset 98 (local hacks of ruleset 0) to call the mailer, but any mail
sent to foo(_at_)a(_dot_)foo(_dot_)com is returned as unknown user???

Assuming you're using the sendmail V8 m4 config file generators, add
FEATURE(mailertable) and MAILER(procmail) to the .m4 file, then rebuild
the .cf.  Then generate the mailertable database with an entry like:

        .foo.com        procmail:/the/procmail/rc/file/location

Don't forget to generate the hashed form of the database.  The
specified rc file is then called for all mail to addresses whose host
part ends in foo.com.  (You may need another entry for just plain
"foo.com".)  The rc file is passed the envelope sender as $1 and the
envelope recipient as $2, so you can do things like:

        RECIPT = $2

        :0
        * RECIPT ?? ^^someuser(_at_)bar\(_dot_)foo\(_dot_)com^^
        ! some(_at_)where(_dot_)else


If you don't generate your .cf from the .m4 config generators, consider
doing so, as they've cleaned up a lot of stuff.  If you _have_ to do it
by hand, the rules would look something like:

R$*<@$*.foo.com.>       $#procmail $@ /the/procmail/rc/file $: $1<@$2.foo.com.>
R$*<@foo.com.>          $#procmail $@ /the/procmail/rc/file $: $1<@foo.com.>

But that's off the top of my head, so don't trust it too much.


Philip Guenther

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