Thursday, January 13, 2005

Fixing sender address with sendmail


I have been trying to send email on one of my linux workstations, but the sender address has the host name of my machine. This causes problems because the host name is not a publicly resolvable name. I found the solution on this page.




Create a file /etc/mail/genericstable

Put the following in it:


username username@domain.com


run


makemap hash /etc/mail/genericstable < /etc/mail/genericstable


Add the following to /etc/mail/sendmail.mc




FEATURE(masquerade_envelope)dnl

FEATURE(genericstable)

GENERICS_DOMAIN(hostname)

GENERICS_DOMAIN(hostname.sub.domain.com)

GENERICS_DOMAIN(sub.domain.com)



run:


m4 /etc/mail/sendmail.mc > /etc/sendmail.cf



then


/etc/init.d/sendmail restart


In postfix, all you need to do is specify


myorigin = $mydomain


in the main.cf file.