1

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
masegaloeh
  • 17,978
  • 9
  • 56
  • 104
user151851
  • 1,833
  • 2
  • 12
  • 10

1 Answers1

1

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 documentation

After the message is queued, send the entire message to the specified transport:destination. The transport name specifies the first field of a mail delivery agent definition in master.cf; the syntax of the next-hop destination is described in the manual page of the corresponding delivery agent. More information about external content filters is in the Postfix FILTER_README file.

And your question about why it isn't working, please check the maillog. My guess that you should add mymilter:dummy instead only mymilter in parameter content_filter. See the example in this official documentation.

The final note, if you modify master.cf then it would preferable to use postfix stop; postfix start to make postfix read the configuration.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104