How can it be achieved that sendmail residing on SERVER send outgoing mail with sender domain
mail.foo.bar instead of SERVER.foo.bar?
We cannot send mail from the mailserver itself, as sendmail tries to send all mails from the server with addresses like
somename@SERVER.foo.bar. Since SERVER.foo.bar is not a registered domain, our ISP's relay rejects the messages. We, however, have registered domain mail.foo.bar, which sendmail should use.
Strangely enough, the case is the opposite when mails are sent not from our mailserver, but from a client (our mailserer acting as a relay). In such cases outgoing mails are sometimes rejected when the client is configured to use smtp server mail.foo.bar. Mails sent from a client are never rejected with that error, if the client is configured to use smtp server SERVER.foo.bar.
Are these two problems due to sendmail configuration errors? How to correct them?