I can't get the milter triggered when a new email is accepted by Postfix before-queue. Obviously, I don't do something properly but I can't figure out what.
I have the following setup: Ubuntu Server, Postfix 2.11.
The Postfix service is working and receives emails to the local accounts properly.
Script /tmp/milter.sh (owner: me, group: me, permission: rwx-rwx-rx) logs some string each time it's run. It works properly when launched under user me in the terminal.
In /etc/postfix/master.cf
, I have:
smtp inet n - - - - smtpd
-o content_filter=mymilter
...
mymilter unix - n n - - pipe
flags=F user=me argv=/tmp/milter.sh
The new configuration is loaded by
sudo postfix reload
Looks like you confused about Milter, before and after queue filter. Those three items was different from each other. I suggest you to read the documentation about Postfix Milter support, before queue filter and after queue filter.
Parameter
content_filter
indicated that you run AFTER-QUEUE content filter. Snippet about this parameter from Postfix documentationAnd your question about why it isn't working, please check the maillog. My guess that you should add
mymilter:dummy
instead onlymymilter
in parameter content_filter. See the example in this official documentation.The final note, if you modify
master.cf
then it would preferable to usepostfix stop; postfix start
to make postfix read the configuration.