disbribution list t...
 
Notifications
Clear all

disbribution list to all email address?

7 Posts
3 Users
5 Reactions
463 Views
(@jolmir)
Joined: 9 years ago
Posts: 18
Topic starter  

I have a question, my newly installed Carbonio email server has 1,200 accounts and I need to add them all to a distribution list, however I have not found a way to do it all at once, or at least 20 at a time, is there a way? So far I have only been able to do it one by one but at a certain number it no longer allows me to add more.


   
Quote
(@cvidal)
Joined: 13 years ago
Posts: 21
 

You have 2 ways to do it:

1- The hard way, on the Linux prompt

- As 'zextras'  user export all accounts with "zmprov -l gaa > /tmp/accounts", then edit /tmp/accounts and remove the system accounts (galsync, spam, ham, admin).

- Add the members with a loop like:

for a in $(cat /tmp/accounts); do
  zmprov adlm your_mailing_list@foo.org $a
done

2-The easy way (but with sophisticated LDAP query)

- Use "Dynamic Mode" in the mailing list creation on Carbonio's admin console. This lets you define a LDAP query to create your mailing list. The best thing is that you can also use extra fields like "Company", "Address"  or even "Pager" or "Fax number" as ways to identify company departments, or branches, or any other features, even if they have nothing to do with a fax or a pager.

In this way you can create dynamic groups that update automatically when new members arrive or quit your organisation.


   
ReplyQuote
(@anahuac)
Joined: 1 year ago
Posts: 315
 

@cvidal your script is awesome.... I would like to contribute to make it a bit more efficient, if you let me?

So, in you script zmprov runs to every single account. It works but it's pretty slow, and when you have to add 1200 accounts it might take a long time to process.

I have been using a different approach: create a file with all commands without zmprov and then pipe it to zmprov just once. Let me show how:

>/tmp/add_list.txt
for $email in $(zmprov -l gaa | sort) ; do
  echo "adlm your_mailing_list@foo.org $email" >> /tmp/add_list.txt
done

cat /tmp/add_list.txt | zmprov

This way zmprov runs just once and add all those entries on the LDAP super fast.

Give it a try and let me know what you think 😀 

Regards

 


   
ReplyQuote
(@cvidal)
Joined: 13 years ago
Posts: 21
 

@anahuac 

Beautiful! 🙂

-----------------------------------------


   
anahuac reacted
ReplyQuote
(@jolmir)
Joined: 9 years ago
Posts: 18
Topic starter  

@anahuac
brilliant! worked perfectly, thanks

sleep problem

   
anahuac reacted
ReplyQuote
(@jolmir)
Joined: 9 years ago
Posts: 18
Topic starter  

@anahuac

Thank you, at the time I solved it and the process was very fast, now I have a new scenario, I have in a txt file line by line all the accounts that I want to add to a new distribution list, what would be the best option to create the list as well from the script, thanks in advance


   
ReplyQuote
(@anahuac)
Joined: 1 year ago
Posts: 315
 

Use cli zmprov command and a simple shell script "for" loop =)


   
ReplyQuote