How to set up a mail list so that you can email ALL of your domains at one time

From QmailToaster
Jump to navigation Jump to search

Have you ever wanted to email all the user accounts on all domains on your server at the SAME time (server downtime notifications, etc)? Now you can and the best part is that it is very simple to do!

The first thing you need to do is to create a mailinglist on your default domain (does not have to be the default domain, however usually this is your domain anyway). I would suggest making the name of the list something obtuse (not easy to guess so as to prevent spam) and also set it so that only moderators can post (another spam stopping trick).

Once you have set up your mailing list, copy the script below into a file called "". Put this file into your /etc/cron.daily directory

# vi /etc/cron.daily/
# script name:
# function: delete member and re-subscribe existing email accounts on all domain
# in your server into a mailing list for public announcement
# 06/15/2010 - Scott Hughes <>
# Initial creation of script to create an import text file of all
# users on system and then import it into an already created
# ezmlm mailing list.
# 04/16/2011 - Scott Hughes <>
# Added the complete removal of list subscribers before list
# generation to take care of deleted accounts. Thanks to Pak Ogah
# for the idea.
# 04/19/2011 - PakOgah <>
# Use variables for mailing list name
# Name of your mailinglist
# Do not edit codes below:
echo "All user mailing list generation..."
# Separate domain and listname
# Deleting current subscribers from mailing list
rm -f /home/vpopmail/domains/$domainname/$listname/subscribers/*
# Generate mailing list import file
#/home/vpopmail/bin/vpopbull -n -V > ~/alluserslist.txt
# Import List into ezmlm mailing list
~vpopmail/bin/vpopbull -n -V | ezmlm-sub ~vpopmail/domains/$domainname/$listname
exit 0

Then change the permissions so that it is executable:

#chmod +x /etc/cron.daily/

That's all you have to do. When the script runs it will first delete all the current subscribers and then re-create them from the domains and users on your server.