I have a sendmail problem, and I'm anything but a sendmail guru -- I could use some help.

My problem is that I have a system intended to be more or less an "appliance" -- it's not intended to have an admin. Because of this, it needs to be able to "call home" by sending email. As we have configured it, this works fine -- using sendmail, it finds the appropriate relay by looking up an MX record and everything works fine.

Now, however, because of security concerns, we want to limit it to using exactly one relay, so for example relay.corp.example.com. Should the user configure it to use, say, fubar.example.com, the mail sending should fail or be deferred.

I thought that by configuring sendmail with a /etc/mail/server.switch file containing

hosts files

without dns, I'd get that effect. This doesn't work -- instead, if it gets mail addressed to foo@example.com, it tries to talk directly to example.com, and ignores the configured server.

Any ideas?

Update

Okay, I tied both schemes experimentally, and they both seem to work. Wish I could mark them both correct.

Here is an M4 file for a SuSE system for simply forwarding ALL email to the relay host.
(Its included in the SuSE distribution as well). You simply do m4 x.mc >x.cf where x.mc is the file below and x.cf would be the file to replace your sendmail.cf file (usually in either /etc/sendmail.cf or /etc/mail/sendmail.cf).