Subject: Re: Procmail/Sendmail config for Proxy Domain

From: [email-masked] (Stephen R. van den Berg)
Date: Tue, 28 Feb 1995 19:28:50 +0100

Rusty H. Hodge <[email-masked]> wrote:
>What I will need to do is make sendmail re-route all mail for a specific
>domain to a local users account. Then that user has procmail setup to route
>incoming mail to the eventual destination, and has autoresponsders and
>such.

>But I don't know how to make sendmail pass this proxy domain on to the user
>(leaving the to information intact).

If you are using the recommended Mlocal definition for procmail (see
examples/advanced in the procmail distribution), you can simply pass along the
original destination address as the "hostname" parameter to the Mlocal mailer.

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).

"<Clarions sounding> *No one* expects the Spanish inquisition!"

---

From: Samuel Tardieu <[email-masked]>
Date: Wed, 1 Mar 1995 11:43:30 +0100

>>>>> "Stephen" == Stephen R van den Berg <[email-masked]> writes:

    Stephen> Rusty H. Hodge <[email-masked]> wrote:
    >> What I will need to do is make sendmail re-route all mail for a
    >> specific domain to a local users account. Then that user has
    >> procmail setup to route incoming mail to the eventual
    >> destination, and has autoresponsders and such.

    >> But I don't know how to make sendmail pass this proxy domain on
    >> to the user (leaving the to information intact).

    Stephen> If you are using the recommended Mlocal definition for
    Stephen> procmail (see examples/advanced in the procmail
    Stephen> distribution), you can simply pass along the original
    Stephen> destination address as the "hostname" parameter to the
    Stephen> Mlocal mailer.

I think I've missed the original post, so I'll answer this one.

I've setup sendmail/procmail to redirect mail for [email-masked]
to me.

First, I've created a 'batch' mailer (the name is not appropriate but
at the time I did it I didn't know exactly what I wanted :), with the
following definition:

Mbatch,         P=/usr/local/bin/procmail, F=lsDFMShPfn, S=10, R=20/40,
                A=procmail -t RECIPIENT=$u /etc/sendmail/batch/$h

Then I declared (via a mailertable, see sendmail 8.6.10 documentation)
that mail for antinea.enst.fr will use mailer 'batch' for host
'antinea.rc'.

The mail is then redirected automatically to the file
/etc/sendmail/batch/antinea.rc (a procmail rc file), which contains:

#####
SHELL = /bin/sh
 
:0hfw
| /usr/local/bin/formail -I "X-Antinea-For: $RECIPIENT"
 
EXITCODE = ""
TRAP = "/usr/local/bin/procmail -d tardieu"
 
:0
/dev/null
#####

The mail is delivered into my mailbox (tardieu), in the SAME process
(that's why I have to use EXITCODE and TRAP), after the header line
"X-Antinea-For: foo" (if the mail was sent to [email-masked]) has
been added.

In my .procmairc, I check for "X-Antinea-For:" line, extract the
recipient's name, then do the appropriate action.

Since this is done in the same process (the one launched by sendmail),
I can exit with a code of 67 (EX_NOUSER in sendmail's sysexits.h) if I
want sendmail to return "user unknown", ... 

I've setup this to handle mail for PPP machines (some guys here have
PPP accounts but want that mail sent to their
not-always-connected-to-the-net machines arrive in a file) and this
works well. I have a similar script which handles mail for
[email-masked] (when a user leaves, I redirect his mail to
[email-masked], and this script send a message to the sender to
warn him that the address isn't incorrect (i.e. was valid in the past)
but the user has left, eventually giving the new address and
forwarding the mail to this new address).

Hope this helps.

  Sam
-- 
"La cervelle des petits enfants, ca doit avoir comme un petit gout de noisette"
                                                       Charles Baudelaire