Score:1

Postfix: virtual dovecot users + catch all to script

cn flag
Tom

In my postfix configuration, I'm forwarding (PIPE) all emails to a script. But I also have some virtual mailboxes in dovecot that should be prioritized.

main.cf

...
# Handle mailboxes from database 
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_maps = mysql:/etc/postfix/virtual-mailbox-maps.cf
virtual_mailbox_base = /var/mail/vhosts
virtual_transport = dovecot
local_transport = virtual
local_recipient_maps = mysql:/etc/postfix/virtual-mailbox-maps.cf

# fallback to mailinglists when users are not database
fallback_transport = ScriptTransporter
...

The fallback should be a catch-all transport for all aliases not in the virtual mailbox, but the received mails will never reach the fallback_transport but will always end in a Recipient address rejected: User unknown in local recipient table error

EDIT: The (Symfony) script does check on aliases itself and stores these emails in a database, as these aliases change dynamically, I would like to check them via the script itself rather than using postfix to have more flexibility and control.

Is a configuration like this possible in another way? Thanks

anx avatar
fr flag
anx
You can imitate what `fallback_relay` does for `local` because you have access to the list of virtual mailboxes - similar to your virtual-mailbox-maps you could also have a query to be used for `transport_maps` (no-op for all existing addresses, plus static default for your script).
anx avatar
fr flag
anx
I would usually prefer *not* receiving crap at all, and then still prefer remapping those recipients to something descriptively named (an alias *all unmatched -> [email protected]*) instead of passing them to their transport straight away, but which solution is truly better depends a bit on context. Mind editing your question and saying *why* you would want to receive mail to addresses that your system considers nonexistant?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.