Advertisement

Mailing List

E-Mail Address:

Home arrow Articles arrow WHM/Exim Simple Mailing List
WHM/Exim Simple Mailing List Print E-mail

Overview:

This HOW-TO will allow you to make a very simple mailing list which works by sending an email to a special address.

For example to send an e-mail to the list, you simply send your message to list@domain.tld and it will get forwarded to every address in the list.

While WHM/cPanel comes with MailMan management it is far too complex, sometimes a very simple distribution list is all what's needed.

This HOW-TO assumes the following:

  • You have root access to your server
  • You have WHM/cPanel installed on the server

Preparing Your List:

Use any text editor to type your list of e-mail addresses, one on each line, please insure using UNIX End-Of-Lines in the file. e.g.:

user1@userdomain1.com
user2@userdomain2.com
user3@userdomain3.com

Save the file as list.txt & upload it to your home dir on the server.

Create an Exim Alias:

Login as root & execute the following commands:

cd /etc/valiases/
pico domain.tld

Add the following two lines at the end of the domain.tld file:

# Mailing List
list@domain.tld: :include:/home/username/list.txt

Where:

domain.tld = the domain name you wish to create the list alias at
list@domain.tld = the Mailing List address you wish to use
username = the user home dir for domain.tld

Secure Your List:

Your list is already working at this point, however any person can send an e-mail to list@domain.tld and it will be delivered to all your list recipients, which is probably something we don't want.

Securing the list requires adding an Exim filter:

cd /etc/vfilters
pico domain.tld

Add the following lines at the end of the domain.tld file:

if
$header_to: contains "list@domain.tld"
and not $header_from: contains "authuser@domain.tld"
then
save "/dev/null" 660
endif

Where:

authuser@domain.tld = is the email you will send messages to the list from

Now you can only send messages to the list from authuser@domain.tld any messages arriving from a different address will simply be discarded by Exim.

Sorting & Duplicates:

You can sort and check your list for duplicates easily with the following commands:

sort list.txt > sortedlist.txt

Produces a new file [sortedlist.txt] with all address sorted alphabetically.

uniq -d sortedlist.txt

Outputs any duplicate addresses in your list.

Improvements:

One draw back to this method, is that you lose the ability to edit mail filters through cPanel for the domain used for the list, as using cPanel Exim filters editor will erase the filter we added by hand.

Ideally if the filter rule can be moved to a perl script, then we can keep the ability to edit mail filters from cPanel.

If someone can convert the Exim filter required to Perl script please let us know...

 
Need Hosting?
All our Hosting Packages include as standard e-mail virus scanning and advanced SPAM filtering. As well as our own custom developed WebMail interface.
 
Bookmark this site!