"All-Users" List

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.

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 $*

Recent Updates

  • 8 months 3 weeks ago
    1.27.2 update
  • 9 months 4 days ago
    Drupal 10/11 config
  • 9 months 5 days ago
  • PHP
    9 months 5 days ago
    PHP 8.3.11 and AlmaLinux
  • 9 months 6 days ago
    New version of Pound