Configure Sendmail to use a smarthost for sending email

To configure Sendmail to use a smarthost to send email do the following:

vi /etc/mail/sendmail.mc 

Change this line, or add it if it doesn't exists yet:

define(`SMART_HOST',`smarthost.example.com') 

Generate new Sendmail config:

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

Restart Sendmail

service sendmail restart