We are running an outbound SPAM filter, and we'd like to be able to have the mail sent through that filter, even when it's to a local user. Is there a way to force sendmail to use the SMART_HOST, even when it is going to be delivered locally?
Example
Here's what I want. My host is example.com. If I send an email from [email protected] (using SMTP) to [email protected], I want the email to go from mail.example.com to outbound.example.com to inbound.example.com, then back to mail.example.com. Is this possible without creating an endless loop?
Yes, you'll want to set the MAIL_HUB and LOCAL_RELAY options too. See the section titled
MASQUERADING AND RELAYING
in the Sendmail ReadMe.Within Sendmail alone that's impossible (as far as I know). What you could do however is:
That, in theory, should catch almost everything but it may break things badly. I've no idea what'll happen if somebody calls sendmail locally. If you're running a webmail install check to see if you can configure it to send all email via outbound.example.com instead of locally.
It may be simpler to integrate the spam filter in mail.example.com.
This sounds like a job for procmail as the LDA. Use it to invoke your spam filter for any locally generated email.
define(
PROCMAIL_MAILER_PATH',
/usr/local/bin/procmail') FEATURE(local_procmail_lmtp) MAILER(procmail) MAILER(procmailnoalias)dnland in your global procmail rule, look for an x-header not present to then send the mail through for scanning
e.g :0H * < 10000000 * !^X-Locally-Scanned: MySuperScanner