Skip to main content
setup Mailman mailing list

Quickly setup Mailman mailing list with Exim 4 for a subdomain

Goal: to setup mailing lists - listname@subdomain.yourdomain.com

Resources Required / Assumptions:

  • An ubuntu/debian based server with no email servers configured already (no MTA is working already) -- should have a static IP [note: redhat/fedora based should also work fine, but the installation commands & configuration file paths may vary]
  • A domain-name, with DNS record access (note that you could use the steps explained to setup mailing lists on main domain as well, not just on subdomains)

Setup DNS records:

Create an MX record on the DNS manager of your domain, as follows:

  • Priority: 10
  • Host: {your-subdomain-name} -- eg: "lists" to setup emails {name}@lists.{yourdomain.com} -- alternatively, use "@" for hosts to set up email for root domain {name}@{yourdomain.com}.
  • Points to / Value: {IP address of the server where you intend to run the mailing list}

Setup Exim 4 MTA:

To be able to run mailing lists, first the server should be configured to receive incoming emails. An MTA should be installed & configured for the same. This particular process seems to be so much automated & already there are lot of tutorials explaining how to do that.

I followed https://www.unixmen.com/howto-install-exim4-mail-server-in-ubuntu-and-linuxmint/ for this and it worked (make sure to use the domain name, that was configured in previous step). However, I had to make a few server alterations in addition to this as explained in next step.

Server Configuration & Test Incoming Email:

Make these server changes:

  1. Setup the hostname as the domain name (with the subdomain) that you intend to use to receive emails: sudo hostname {subdomain.yourdomain.com}
  2. Make sure ports 25 and 587 are open on the server [the firewall used may vary from server to server and I believe google should be the best resource to do this].

After you're done with the above, restart the mail server: "sudo service exim4 restart" and try sending an email to {server-user-account}@{subdomain.yourdomain.com} - then SSH login to the server using the same user: {server-user-account} and type "mail" command - you should get a list of emails received for that user account. If this doesn't happen, something might have gone wrong - just go back and try following the steps more closer. Once it works, move onto mailman setup.

Gotcha: even without proceeding further to setup mailman, you can run a simple mailing list. Simply edit /etc/aliases and use {list-name}: user1@example.com, user2@example.com -- ofcourse, without {} and any emails sent to {list-name}@{subdomain.yourdomain.com} will automatically be forwarded to user1@example.com, user2@example.com, etc., -- but you won't get a nice administrative interface and people management from browser as in mailman.

Setup Mailman:

Just like Exim, Mailman is pretty much straight forward to setup. I followed https://www.grosseosterhues.com/2011/08/installation-of-mailman-in-ubuntu/ (including the tweaks to exim config to merge exim & mailman accounts) and in addition to that, I had to do two other steps to get the mailman setup fully working. Here are those:

  1. Adding extra statements to the start of exim configuration file as explained here: https://answers.launchpad.net/ubuntu/+source/mailman/+question/120447 (and then re-building exim config, restarting exim) -- without this, email delivery to mailman kept failing with "PIPE not found" errors.
  2. Mailman has an "agent" [system service] to process emails delivered to it's folders & forward them to the list users. For some reasons the agent failed to start on it's own and I had to issue: sudo service mailman start to get it started.

If everything went well, you should now be running a mailing list on your own & its ideal for small to medium size groups. We use it for our internal mailing lists at present. Let me know if you find any difficulties in getting your list setup.