YunoHost / issues

General issue tracker for the YunoHost project
72 stars 8 forks source link

Use the group mechanism as mailing distribution list #1537

Closed yalh76 closed 1 year ago

yalh76 commented 4 years ago

Tested and working.

If you create a new group in YunoHost > 3.7 and add users in that group (let say we name that new group: grp_accounting) Then using phpldapadmin_ynh, you can go on the new group: cn=grp_accounting,ou=groups,dc=yunohost,dc=org Add the mailGroup objectClass to it and provide an email address for example accounting@example.com considering your YunoHost manage mails for the domain example.com

Then modifying /etc/postfix/main.cf at https://github.com/YunoHost/yunohost/blob/374369a1db91c3bf0e386ba9ce34c2e970ff91e5/data/templates/postfix/main.cf#L71 from virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf to virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf,ldap:/etc/postfix/ldap-groups.cf

And creating a new file: /etc/postfix/ldap-groups.cf

server_host = localhost
server_port = 389
search_base = dc=yunohost,dc=org
query_filter = (&(objectClass=groupOfNamesYnh)(mail=%s))
exclude_internal = yes
search_timeout = 30
scope = sub
result_attribute = memberUid, mail
terminal_result_attribute = memberUid

After postfix reload service postfix reload, you can send a mail to accounting@example.com and it will received by each members of the group: grp_accounting.

If it's a good way to manage mailing distribution list, maybe just have to request an optional email address when creating a new group through the webadmin would be enough to implement internal email distribution list in YunoHost

Ping @kay0u and @Josue-T

alexAubin commented 4 years ago

Need to add emojo " :astonished: " as github reaction for comments :o

yalh76 commented 4 years ago

Need to add emojo " 😲 " as github reaction for comments :o

Let say it would be a good improvement to group_permission ^^ And maybe not too difficult to PR even if I don't like to ask already overheated guys to do new PR ^^

alexAubin commented 4 years ago

If it's a good way to manage mailing distribution list, maybe just have to request an optional email address when creating a new group through the webadmin would be enough to implement internal email distribution list in YunoHost

Was gonna say "let's just use the group id", but the tricky part is actually to know which domain to use considering we're possibly in a multidomain context :|

yalh76 commented 4 years ago

If it's a good way to manage mailing distribution list, maybe just have to request an optional email address when creating a new group through the webadmin would be enough to implement internal email distribution list in YunoHost

Was gonna say "let's just use the group id", but the tricky part is actually to know which domain to use considering we're possibly in a multidomain context :|

For that there is already a solution I think: to use the same form for mail in /yunohost/admin/#/users/create

Josue-T commented 4 years ago

Hello,

I also thought about to implement this. There was a really old PR which did this, but it was never merged : https://github.com/YunoHost/yunohost/pull/176

Maybe we can set this as optional. We can by example add a command like that:

# Set mail alias
yunohost user group update groupname --mail example@domain.tld
# Remove alias
yunohost user group update groupname --clear-mail

If you are interested to work on this side I would be happy to leave this work to you as I have much other things to do.

alexAubin commented 2 years ago

I'm partially implementing this in https://github.com/YunoHost/yunohost/pull/1408 : https://github.com/YunoHost/yunohost/pull/1408/commits/767b5c3d7ecb141d5ce3e80fea3227443e71d4cd

alexAubin commented 1 year ago

FYI I'm finally doing the full implementation in https://github.com/YunoHost/yunohost/pull/1539

(at least in the CLI, still to be implemented in the webadmin some day)

alexAubin commented 1 year ago

Done in https://github.com/YunoHost/yunohost/pull/1539

Xananax commented 1 year ago

Sorry, I know this is closed, but I am unsure where else to ask; this may be useful to others in this thread.

I've looked at the PR and tried following instructions, but it seems this isn't working for arbitrary groups?

I created a "notification" group, then ran:

 yunohost user group add-mailalias notification notification@domain.tld

The command ran successfully, but when sending an email, I got the error:

The mail server responded:
<notification@domain.tld>: Recipient address rejected: User unknown in virtual mailbox table.

Reading the PR description, it seems to interest itself specifically in providing this functionality to the "admin" group. Do you know if an additional setup is required to make this work for another group?

rob-hills commented 1 year ago

@Xananax , I just ran this command today and it has worked for me.

I did add two users to my group before running the "add-mailalias" command. Did your group have any members? If not, perhaps this is why it didn't work?