mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
9.09k stars 1.19k forks source link

Allow enabling/disabling alias domain as sender email address individually per user? #1523

Open mmilitzer opened 6 years ago

mmilitzer commented 6 years ago

Currently, when setting up an alias domain, this also automatically adds a new "Allow to send as" email address in the form of user@aliasdomain.tld to each user/mailbox of the main domain (and visible as new sender alias in Sogo).

However, I think there may be often the use case also that not all users should be able to use the alias domain. But creating an individual per-user alias from one domain to another (e.g. x@aliasdomain.tld -> y@maindomain.tld) is only possible when also an alias domain is configured first.

So it seems having a certain domain only available to some users as "Allow to send as" email is only possible when really setting up multiple main domains and then selectively allowing just some users to use the other domain+aliases via delegation in Sogo. Am I right?

It would be nice if there were an additional option while configuring an alias domain that would make the alias domain to not globally apply to all users so that rather only explicitely specified aliases with this domain would then still show up in the "Allow to send as" list only for those users that are the "Goto address" of an alias.

johegl commented 6 years ago

Same here. We could really use that feature to decide which user is allowed to use which domains and/or alias domains.

Viktova commented 6 years ago

+1 for the possibility to control who can send from an alias address

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Viktova commented 5 years ago

bump, @andryyy anything on this?

m0vva commented 5 years ago

bump again, this would be a great enhancement. Has anyone found a workaround?

andryyy commented 5 years ago

Not working on it though. Enotime.

furrinub commented 6 months ago

is there any update?

PseudoResonance commented 3 weeks ago

At least for domain-wide config, it should be possible to remove the alias from SOGo if another tinyint(1) column is added to alias_domain and the view grouped_domain_alias_address is modified to look something like this, where it checks if an alias has the send_as property set.

-- mailcow.grouped_domain_alias_address source

CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `grouped_domain_alias_address` AS
select
    `mailbox`.`username` AS `username`,
    ifnull(group_concat(`mailbox`.`local_part`, '@', `alias_domain`.`alias_domain` separator ' '), '') AS `ad_alias`
from
    (`mailbox`
left join `alias_domain` on
    (`alias_domain`.`target_domain` = `mailbox`.`domain`))
where `alias_domain`.`send_as` = '1'
group by
    `mailbox`.`username`;

Additionally, postfix would need to be reconfigured in a few places, like here. I believe if this also checks if the alias domain has the send_as flag, it should allow you to configure if you can send from an alias.

As for per-user config, I'm not sure how that could be accomplished nicely. Perhaps using the sender_acl table to store overrides for the alias_domain table being disabled? Then the previous 2 checks I mentioned can additionally check for the given username in sender_acl, check what domains they have access to and add them to the list.