Sendmail tip : Passing Local Mail to a Mail Hub

https://www.safaribooksonline.com/library/view/sendmail-cookbook/0596004710/ch03s04.html

Problem

You have been asked to create a sendmail configuration that sends all local mail to a mail hub, while directly delivering mail addressed to external systems.

Solution

Create a sendmail configuration containing the MAIL_HUB define to identify the mail relay host for local mail. Use the LOCAL_USERcommand to exempt the root user’s mail from relaying. Here are sample commands:

dnl Define a relay server for local mail
define(`MAIL_HUB', `smtp.wrotethebook.com')
dnl Users whose mail is not passed to the mail hub
LOCAL_USER(root)

Rebuild and reinstall sendmail.cf, and then restart sendmail.