The below is specific to CentOS-5.4 and may work similarly with other distros.
-
Additional packages required if not installed already:
Edit ”/etc/mail/sendmail.mc”:sendmail-cf
m4
make
cyrus-sasl-plain
define(`SMART_HOST', `{smtprelay.domain.tld}')dnl
FEATURE(`authinfo',`hash -o /etc/mail/authinfo.db')dnl
AuthInfo:smtprelay.domain.tld "U:{username}" "P:{password}" "M:PLAIN"
cd /etc/mail
make
Now mails sent to localhost is relayed via your SMTP provider.