Configuring sendmail to relay to a Smart Host

To configure sendmail to be able to relay emails from a UNIX system (its host) to another SMTP or Exchange server (ex. the corporate exchange server), you need to modify /etc/mail/sendmail.cf and set the Smart Relay:

#/etc/mail/sendmail.cf:
DSmy_email_gateway

You have to make sure that you have appropriate entries in the nsswitch.conf to first resolve from /etc/hosts if you have problems with setting up a DNS!!

#/etc/nsswitch.conf:
hosts:  files dns

Finally apply changes by restarting sendmail:

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start