I am fairly new to Postfix, Dovecot and have only basic knowledge of mail routing.
There is a server that supposed to receive emails for variety of mailboxes with unlimited domains. (firstname.lastname@example.org, email@example.com, firstname.lastname@example.org, email@example.com - thousands of them.) I need to handle only few emails as regular IMAP boxes, the rest of emails must be handled by php script, actually forwarded to real mailbox hosted by 3rd party.
So firstname.lastname@example.org handled as regular mailbox, stored locally, IMAP, but email@example.com forwarded to firstname.lastname@example.org.
Dont really understand how to implement such logic. Maybe I can use Postfix + Mysql with list of mailboxes to forward? List is dynamic
Or maybe some opposite arrangement: incoming emails first handled by php script and some piped to Postfix?
Need some help here..