"All-Users" List

Automatically add new users into an "All-Staff" mailing list.

Some organizations might find it useful to have a mailing list that all users of the email system are a member of.
Add existing domain users to a list
If you already have users in a domain, here's a shell script that can add all the users to a list. You'll have to modify the variables at the beginning to reflect your site:

#!/bin/sh

listName=<listname>
domain=<domain>

ezmlmBinDir=/usr/local/bin/ezmlm
vpopmailDir=/home/vpopmail
vuserinfoBin=$vpopmailDir/bin/vuserinfo
domainDir=$vpopmailDir/domains/$domain

userList=`"$vuserinfoBin" -n -D "$domain"`

for currentUser in $userList; do
  $ezmlmBinDir/ezmlm-sub $domainDir/$listName $currentUser@$domain
done

NOTE: You might need to go through the mailing list subscribers if there are any addresses in the domain that you do not want on the list

Automatically adding new users via onchange
Here's a script that can be implemented via the vpopmail onchange functionality to automatically add/delete users to a mailing list when they are added to or deleted from the domain.

cd /usr/local/bin
wget http://www.dwadson.com/files/scripts/allUsersList.pl
chmod ugo+x allUsersList.pl

Edit /usr/local/bin/allStaffList.pl and adjust the variables to reflect any differences in your installation, such as the name of the "staff" mailing list.

Once those changes are made, add the allUsersList.pl script to the onchange script. Edit /home/vpopmail/etc/onchange and add:

/usr/local/bin/allUsersList.pl $*

Credits

Various bits of code, scripts, and procedures were put together with information from John Simpson's qmail.jms1.net website. It's an excellent resource on managing and setting up a Qmail server.

Recent Updates

  • 2 years 3 weeks ago
  • 2 years 3 weeks ago
  • 2 years 3 weeks ago
    php 8.x
  • 2 years 4 weeks ago
    10.6.7
  • 2 years 1 month ago
    Drop Centos 5/6 stuff