Written by Vincent Zweije <email@example.com>.
This method uses the generics database. This is not a
trivial solution in the sense that you can quickly edit your
sendmail.cf by hand. Write up a
sendmail.mc and use
the m4 macro language method instead. Really.
Words marked with an asterisk
Suppose you have a dialup account at an ISP. On your own machine, you have your working account, the name of which is different from the one at your ISP. Consequently, your local and global email addresses differ.
When mail gets sent out, it would be a nice feature to
You never have to worry again about setting a
From in your email. And you are sure that bounces
The generics table is a table that maps locally valid email addresses to globally valid email addresses. The correct term for this is "masquerading". Masquerading translates email addresses, but it does not change where a message gets sent by your sendmail. (If you want to reroute messages, you need aliasing.)
A good place for the generics table is
/etc/mail/generics, but you can configure any place you
like in your
sendmail.mc. The generics table has one line
for each masquerade. The line contains two addresses separated
by white space; the first address is masqueraded into the second.
Here is a little example.
$cat /etc/mail/generics lerlings firstname.lastname@example.org jtietze email@example.com vzweije firstname.lastname@example.org $
After you have changed the generics table, you must rebuild the
index to it. You need the
makemap program, which comes with
the sendmail distribution. Go to
/etc/mail, and run
#makemap -hash generics <generics #
The index is now built.
For instance, the username I use on my home machine is "vzweije".
So, on my home machine my email address is <vzweije> (there is
no domain involved). When mail gets sent out, the occurrences of
<vzweije> in the header
The following lines in sendmail.mc configure sendmail to actually use the generics table.
$cat /etc/mail/sendmail.mc [...] FEATURE(genericstable, hash /etc/mail/generics) GENERICS_DOMAIN(love.sense.net sense.net love) FEATURE(masquerade_envelope) FEATURE(allmasquerade) [...] $
Feature "genericstable" tells sendmail to use the generics table. The extra argument, hash /etc/mail/generics, tells sendmail where the generics table is, and what type of index (hash) there is to it.
"Generics_domain" defines the domains to which you wish to apply the generics table. Normally you don't need this, because the generics table applies to local addresses by default. However, you may have a local network to which you have assigned a mail domain, which you wish to masquerade too.
Feature "masquerade_envelope" applies the rewriting process to the
Feature "allmasquerade" applies the rewriting process to recipient addresses as well as to sender adresses. It is useful if you send yourself a local Cc of an outgoing mail; the other recipient will see a Cc to an address he knows instead of a local address. You want this.