What is the best way to add a mail received hook to Postfix? #4254
-
I'm setting up a catch-all alias for my domain and I want to filter messages based on the address. Is there an easy way to add a shell script hook or something similar that runs when mail is received? One option is to write a script that polls imap for new mail but that is inefficient. Aliases can specify a command which will have the mail piped into. There's also a tool called Milter but the setup looks pretty complex. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can probably use Dovecot Sieve? Our Although that's subaddress, you might be able to use a global sieve rule in a similar way. I'm not sure if it'll let you run your own external scripts from sieve, but it'll handle moving mail to where you want it. If you search discussions and issues, I believe some have added an entry to Postfix |
Beta Was this translation helpful? Give feedback.
You can probably use Dovecot Sieve? Our
edge
docs have a revised version with better examples than the current v14 docs:https://docker-mailserver.github.io/docker-mailserver/edge/config/advanced/mail-sieve/#subaddress-mailbox-routing
Although that's subaddress, you might be able to use a global sieve rule in a similar way. I'm not sure if it'll let you run your own external scripts from sieve, but it'll handle moving mail to where you want it.
If you search discussions and issues, I believe some have added an entry to Postfix
master.cf
that runs a shell or python script to process mail, which might work for you.