I would like to pass incoming mail using virtual_transport
to a transport spamassassin
(main.cf: virtual_transport=spamassassin
) and then reinject the scanned mail into postfix using sendmail.
The transport looks like this:
spamassassin unix - n n - - pipe
flags=hu user=vmail:mail argv=/usr/bin/spamc -u ${recipient} -e /usr/sbin/sendmail -f ${sender} ${recipient}
This should be possible acording to the postfix documentation:
High volume sites should avoid using "simple" content filters that re-inject scanned mail via Postfix sendmail(1) and postdrop(1).
With my current sendmail call /usr/sbin/sendmail -f ${sender} ${recipient}
, the mail loops by getting passed back into the queue and then back to spamassassin and so on.
From my understanding of the postfix documentation, mail delivered using postfix sendmail
is dropped in the maildrop
directory and then picked up using pickup
. I tried to append a -o virtual_transport=dovecot
to the pickup transport to avoid the queue, but this didn't help. (Those options can only get appended to smtp transports I suppose).
How can I reinject mail scanned with spamassassin back into the queue for final delivery without causing a loop?