Bulk import emails into EzMLM

From QmailToaster wiki
Jump to navigation Jump to search

Ever had a large list of email addresses that you wanted to import into a mailing list, or converting from another mail program?

It's possible.

If you put all of your email addresses into a text file (Unix format), one email address per line, you can import them into your mailing list (which you already created, right?). Each address MUST contain a @ symbol. The import will stop at the first emtpy line, EOF, or the first email in an invalid format (no @ symbol). You can import your list by using the following command:

ezmlm-sub /home/vpopmail/domains/yourdomain.com/name-of-mailing-list < name-of-text-file.txt

Files copied over from a DOS system contain hidden characters that can cause problems with this import. You should run the file through dos2unix to strip these characters off. The log for subscriptions is at:


If there were any hidden characters in your import file there will be a ? where the bad character was. The only way I found to remove these users is to delete the list and recreate it.

How to email all of your users on all domains

Ever wanted to send out a bulk email to all of your users across all of your domains? Now we have a way of doing just that! Here is what you need to do:

1) On your main domain create a ezmlm mailing list. Be careful what you call it so that you don't get spammed! Creating a list called 'allusers' is NOT a good idea.

2) Copy this script into a file on your system in the /etc/cron.hourly directory. Name it 'list-create':


# 06/15/2010 - Scott Hughes <sonicscott9041@gmail.com>
# 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.

echo "All user mailing list generation..."

# Generate mailing list import file and then import it into ezmlm mailing list
# The next line MUST be all on one line for the script to work correctly!
~vpopmail/bin/vpopbull -n -V | ezmlm-sub ~vpopmail/domains/domainname.net/mailinglistname

exit 0

3) Modify the script to make it executable (chmod +x list-create)

That's it! Remember, for this to work properly, your mailing list MUST be created BEFORE you run this script. If you want to test run the script, just go to the /etc/cron.hourly directory and issue this command: ./list-create