Peter
Peter

Reputation: 1021

Postfix smtp hook not working

I am using a postfix hook to check every mail with a bash script.

I have this line in my master.cf

smtp      inet  n       -       y       -       -       smtpd -o content_filter=myhook:dummy

My script is also called for outgoing emails, I want that the script is just called when I receive any email. How can I configure this?

Best regards

Upvotes: 0

Views: 718

Answers (1)

Tim
Tim

Reputation: 76

My guess is that your incoming and outgoing emails are sent to Postfix through the same process (smtpd using the smtp port: 25).

So the content_filter is applied either way

One way to achieve your goal is to use another smtpd process listening on an other port without the content_filter. In the master.cf:

smtp      inet  n       -       y       -       -       smtpd -o content_filter=myhook:dummy
1025      inet  n       -       y       -       -       smtpd

With this configuration:

  • Every mail sent to the port 25 is filtered.
  • Every mail sent to the port 1025 is not filtered

Upvotes: 1

Related Questions