Configure postfix to use clapf
Edit /etc/postfix/master.cf, and add the following lines:
127.0.0.1:10026 inet n - n - 10 smtpd -o content_filter= -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_milters -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8
Edit /etc/postfix/main.cf and add the following lines:
recipient_delimiter = + content_filter = smtp:[127.0.0.1]:10025 # if you set this, then postfix will give the email address to clapf without # rewriting it so make sure to set the email aliases to the email table receive_override_options = no_address_mappings default_destination_concurrency_limit = 10 smtpd_recipient_limit = 128 lmtp_send_xforward_command = yes smtp_send_xforward_command = yes smtpd_authorized_xforward_hosts = 127.0.0.0/8
If you want LMTP local delivery instead of SMTP, then set server_mode=0 in clapf.conf, and use the following content_filter reference:
content_filter = lmtp:[127.0.0.1]:10025
Issue the postfix reload command
postfix reload
Edit the /etc/aliases file to accept spam@ and ham@ addresses as aliases (or you may use virtual aliases too):
ham: /dev/null spam: /dev/null
Then issue the 'newaliases' command.
Further notes
The clapf daemon can handle a finite number of recipients, 128 by default. If you want more recipients in a single session edit MAX_RCPT_TO in config.h then (re)compile clapf and adjust the smtpd_recipient_limit variable in main.cf. If you want less than 128 you should only adjust the smtpd_recipient_limit variable in main.cf.
Please note that if you want to increase the concurrency, modify the default_destination_concurrency_limit in main.cf, the 127.0.0.1:10026 entry in master.cf and the number_of_worker_processes in clapf.conf, then reload postfix.
The number_of_worker_processe should be greater than default_destination_concurrency_limit:
number_of_worker_processe ›= default_destination_concurrency_limit + 1