Configure sendmail to enable masquerading

Find out which configuration file sendmail is using.

# cat /var/run/
/usr/sbin/sendmail -L sm-mta -C/etc/mail/ -bd -q30m

Make a backup copy of the original configuration file

# cp /etc/mail/ /etc/mail/localhost.cf_original

Go to the directory containing the sendmail configuration files

# cd /usr/share/sendmail/cf

A look at /etc/mail/ will tell you that it is derived from

So, let's make a copy of that configuration file ...

# cp

... and modify it

# vi

To enable masquerading for domain 'mydomain.tld', we could add the following lines to


Save after the required changes have been made and convert it to the .cf file

# m4 ../m4/cf.m4

Overwrite the existing configuration

# cp /etc/mail/

And restart sendmail

# kill -HUP 12345