I'm looking to implement this functionality, which is actually a pretty trivial change. It won't require new menu's, just a setting for the mailbox.
What is needed is the ability to authenticate (username/password) to send mail, but all received mail is forwarded, not delivered locally. The db schema is already sufficient to store this setting, all that is lacking is a checkbox in the ui.
There is now a mail_user.postfix, mail_user.disabledeliver, mail_user.disablelda (and soon mail_user.disablelmtp), all of which are set to the inverse value of 'postfix', which is set by the 'Enable receiving' checkbox currently in the ui. Ie. set postfix='y', and all the disable* are set to 'n'.
I believe all that is needed is an additional checkbox which sets disablelda and disabledeliver (and disablelmtp) separately from 'postfix'. Possibly the password_query in dovecot-sql.conf will as well (return the user info, including password, password_query so auth works, but do not return it in user_query, so no mailbox is available).
I'll test it and see if it's as simple as I hope and send a merge request if so.
A little testing and it turns out it's not that easy. When setting a cc in the mail account, with postfix=y and disabledeliver=n, disablelda=n, the message bounced as user unknown. So... postfix did not expand the virtual alias and change the recipient prior to attempting delivery. Even if it had (half the problem), it would have still generated the bounce. Gotta think about this some more...
Ok, I think I have this working. The trick was to get the mail_user.email -> mail_user.cc forward added to virtual_alias_maps (ahead of the current mysql-virtual_email2email.cf behavior).
This could be done via a new mysql-virtual_*.cf file, or adjusting mysql-virtual_forwardings.cf or mysql-virtual_email2email.cf. I chose the latter, so mysql-virtual_email2email.cf looks like:
user = ispconfigpassword = ee4e1cf821cbf2e37869f479107bca2edbname = dbispconfighosts = 127.0.0.1query = SELECT email FROM mail_user WHERE email = '%s' AND postfix = 'y' AND disabledeliver = 'n' AND server_id = 2 UNION SELECT cc AS email FROM mail_user WHERE email = '%s' AND postfix = 'y' AND disabledeliver = 'y' AND server_id = 2
I left/used the same changes as above (ie. disabledeliver=n and disablelda=n). Still need a ui for those, but the single change above utilizes them.