SUMMARY: how to rewrite outgoing mail?

From: Mike Jenkins (Mike.Jenkins@NCTS.NAVY.MIL)
Date: Thu Mar 11 1993 - 22:21:24 CST


>How do I rewrite outgoing mail to lastname.firstname@domainname?

Most of the responses I got were "I'd like to do that also". A few
said this is easily done with Sendmail+IDA found at uxc.cso.uiuc.edu.
I decided to work with the sendmail that comes with SunOS.

The key to rewriting sender addresses is the metasymbol "${x key$}"
which looks up "key" in NIS map $x and returns the value. This is used
in the ddn mailer ruleset S22 to look up sender addresses of the
form "user@host" in the mail.byaddr NIS map and rewrite it to the
value found in mail.byaddr. The ddn mailer is my outgoing mailer
so I worked on it.

Most of our sender addresses look like "user" and a few like "user@client".
I added a rule to S22 to also look up "user" in mail.byaddr. I also
added some lines to /var/yp/Makefile to rebuild mail.byaddr from the
Firstname.Lastname aliases in /etc/aliases.

If you are similiarly configured like us, all it takes is a line to
S22, 4 lines to /var/yp/Makefile, and a properly setup aliases file.
See below for details. I hope it works for you!

Mike Jenkins
-----------------------------------------------------------------

The rule added right after S22:

        S22
        R$- $:$>3${Z$1$} user
        ...

The /var/yp/Makefile changes at aliases.time:

        ...
        rm $(YPDBDIR)/$(DOM)/mail.aliases;
        #
        # Build my own mail.byaddr wiping out existing mail.byaddr
        #
        @(egrep '^[A-Z][a-z]*\.[A-Z][a-z]*:' $(DIR)/aliases $(CHKPIPE))\
        |( sed -e 's/:/ /' -e 's/@themailhost//' -e 's/,/ /' $(CHKPIPE))\
        |( awk '{print $$2,$$1}' $(CHKPIPE))\
        | $(MAKEDBM) - $(YPDBDIR)/$(DOM)/mail.byaddr;
        #
        ...

The aliases file:

        joe: joe@themailhost
        Joe.Smith: joe@themailhost
        sue: sue@herclient
        Sue.Allen: sue@herclient, sue@elsewhere

The mail.byaddr built from aliases file:

        Key Value
        --- -----
        joe Joe.Smith
        sue@herclient Sue.Allen



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:35 CDT