Configuring the sendmail.cf File (Part 2):
Checking the Red Hat sendmail.cf
file on parrot, you find that no value is assigned to macro M,
which means that masquerading is not being used. Further, you find that there is no class M
declaration in the file. To masquerade the local host as foobirds.org and to masquerade the
outbound mail from the clients robin and puffin, copy the sendmail.cf
file to test.cf
and then edit
test.cf
, changing the macro M declaration and adding a class M declaration:
# who I masquerade as (null for no masquerading)
DMfoobirds.org
# class M: host names that should be converted to $M
CMpuffin.foobirds.org robin.foobirds.org
Given these macro M and class M definitions, parrot rewrites its own outbound mail to user@foobirds.org, as well as rewriting mail from user@puffin.foobirds.org or user@robin.foobirds.org to user@foobirds.org. parrot is a mail server. Although you might use macro M on any system, you won't use class M on any type of system except a mail server.
A problem with using class M is that kathy@puffin.foobirds.org, kathy@robin.foobirds.org, and kathy@parrot.foobirds.org are all rewritten as kathy@foobirds.org. That's great if there really is only one kathy in the entire domain; otherwise, this may not be what you want. Coordinate usernames carefully across all systems. It simplifies the configuration of several different applications.
After setting a value for the M macro in the test.cf file, run a test to see if it works. Running sendmail with the test configuration does not affect the sendmail daemon that was started by the boot script. A separate instantiation of sendmail is used for the test.