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. (email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org - 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 email@example.com handled as regular mailbox, stored locally, IMAP, but firstname.lastname@example.org forwarded to email@example.com.
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..