Is there a way to filter outgoing Postfix email for spam possibly with Spamassassin?

I found this answer about how to do it with Amavis but it's terribly outdated.


If you combine the

smtpd_sender_restrictions = 
   check_client_access cidr:/etc/postfix/internal_clients_filter

from the answer you found with these instructions for clamsmtp incoming filtering (excluding the content_filter paramater and replace: FILTER smtp:[]:12501

with FILTER scan:[]:10025

Replacing with your network address in CIDR notation

Dont forget to

Edit the /etc/clamsmtpd.conf file and change OutAddress: 10025 to OutAddress: 10026. also change Listen: to Listen:


Add the following to /etc/postfix/master.cf

# AV scan filter (used by content_filter)
scan      unix  -       -       n       -       16      smtp
        -o smtp_send_xforward_command=yes
# For injecting mail back into postfix from the filter inet  n -       n       -       16      smtpd
        -o content_filter=
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_helo_restrictions=
        -o smtpd_client_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks_style=host
        -o smtpd_authorized_xforward_hosts=

as per the article.

Sorry if this is confusing.

|improve this answer|||||
  • This only checks for viruses right, using ClamAV, it doesn't prevent spam from being send? – brickmasterj Jan 15 '16 at 8:22
  • wait was your question originally about spam and i've totally mis read it? – Aaron Tate Feb 10 '16 at 2:30
  • It was ;) But at some point I gave up on trying to accomplish this and just went with an external mail server to handle outgoing mail and filter spam. – brickmasterj Feb 10 '16 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.