Wednesday, March 27, 2013

Email domain remapping in sendmail


Sendmail can be configured to remap email domain (sender email) from one to another such as mapping from mail.com to mail2.com

File is: genericstable

Format is:

@mail.com     %1@mail2.com
 

rebuilt it to the correct db format using this command:

makemap hash genericstable.db < genericstable

You need to add the following 2 lines to the sendmail.mc file:

FEATURE(`genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

add the domain to generics-domains, format is:

mail.com

change the sendmail.mc to sendmail.cf using this command:

m4 sendmail.mc > sendmail.cf

Then restart sendmail.

In solaris, use this:

svcadm disable sendmail
svcadm enable sendmail

In Linux, use this

/etc/init.d/sendmail restart