Tag Archives: sendmail

Sendmail Masquerade Using Generic Map

Changes to configure sendmail to masquerade from address allowing me to replace local system email address user@server.localhost.localdomain with another email address like noreply@domain.com or username@domain.com

Create the following files:

root noreply@domain.com
username username@domain.com
example example@domain.com
...
FEATURE(genericstable, hash /etc/mail/generics)dnl
GENERICS_DOMAIN(servername.localhost.localdomain)dnl
GENERICS_DOMAIN(domain.com)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(allmasquerade)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
...

Run the following commands:

$ makemap hash /etc/mail/generics < /etc/mail/generics
$ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
$ /etc/init.d/sendmail restart

Test using the following command:

echo "Checking if masquerade worked" | mailx -s "Masquerade Email Test" user@domain.com

Disclaimer: I would not rely on this information in a production environment.