Installing iRedMail And Mailman On Debian Squeeze

Version: 1
Author: Jason Norwood-Young
Last edit: 22 December 2011

I'm a big fan of iRedMail, which is basically a packaged version of Postfix and the other bits that make Postfix cool, like Spamassassin, greylisting and an LDAP or MySql back-end. One thing I wanted with iRedMail is Mailman, my favourite mailing list server. Integrating the two can be a mission though, so here's some instruction to save you from quite a bit of pain.

The iRedMail guys offer a free admin console for managing user accounts. I subscribe to iRedMail's Pro version of its admin console, which is very useful for clients to self-manage. I don't have anything to do with iRedMail, apart from being a customer.


1. Setting up the server

I'm installing on a clean Debian Squeeze install. The first thing I always do on a new server is:

apt-get update
apt-get upgrade
dpkg-reconfigure tzdata

The last line allows you to set your timezone. It isn't strictly necessary for our purposes, but I consider it good practice to set this up.

Now we need to set up a fully-qualified domain name (FQDN). That means we need a domain like instead of just mailserver. To check what your hostname is, type:

hostname -f

NOTE: The domain name you choose should be different from the email domain you wish to use. If you want your email to come from, do not make your server name - give it a subdomain like obiwan or captainkirk or (if you're boring like me) mailserver.

If you already have a FQDN, you can move on to step 2.

The domain name is set in two places: /etc/hostname and /etc/hosts.

Edit your /etc/hostname to contain your FQDN (for the purposes of this tutorial I will use

For your /etc/hosts file, your first line should look like this: mailserver localhost localhost.localdomain

Now we just need to tell the system to register the change:

hostname -f

You should now see a FQDN. If you don't get one, panic! Er, I mean reboot and check again.


2. Installing iRedMail

At time of writing, the iRedMail version is 0.7.3. Check on for the latest version and adjust accordingly.

cd ~
apt-get install bzip2
tar xjf iRedMail-0.7.3.tar.bz2
cd iRedMail-0.7.3

iRedMail will install everything you need. Accept all the defaults except for the backend - choose MySql instead of LDAP. When prompted for your first virtual mail domain, put in, NOT Answer Yes whenever prompted.

You now have a rocking mail server! That was easy, huh?


3. Installing Mailman

First we install Mailman:

apt-get install mailman

You'll note that Mailman doesn't get started yet. First we need to tell Postfix to send mail to Mailman when it receives mail from certain addresses.


4. Setting up Transport and Alias accounts

We're going to create a virtual domain called, which we're going to use for all our Mailman stuff. Whenever something gets sent to the domain, we're going to forward that on to the Mailman program instead of handling it like a normal mail.

Since we don't want our mailing list to be on the domain but rather just, we'll also be setting up a bunch of aliases to accept the mails sent to Mailman addresses on and instead route them to

We're going to do all this through the MySql database. Point a browser at Notice that it is https and not just http. Also note that if you don't have a name server pointing at your IP address already, you might need to add to your /etc/hosts file on your local computer.

Log in with user root and the password you chose during the iRedMail installation. If you can't remember any details, check out ~/iRedMail-0.7.3/ - iRedMail conveniently saves the locations, usernames and passwords for all iRedMail services in there.

Click on the "vmail" database in the left panel, and then the "SQL" tab. Paste the following command into the tab (after changing the domain to your own of course) and hit Go:

INSERT INTO `vmail`.`domain` (`domain`, `description`, `disclaimer`, `aliases`, `mailboxes`, `maxquota`, `quota`, `transport`, `backupmx`, `defaultuserquota`, `defaultuseraliases`, `defaultpasswordscheme`, `minpasswordlength`, `maxpasswordlength`, `created`, `modified`, `expired`, `active`) VALUES ('', '', '', '0', '0', '0', '0', 'mailman:', '0', '1024', '', '', '0', '0', NOW(), '0000-00-00 00:00:00', '9999-12-31 00:00:00', '1');

That set up our Transport to get everything from to the Mailman app.

Now we need to add the Mailman aliases. You'll need to do this every time you add a new list to Mailman, just search-and-replace "mailman" with your new list name and run the SQL again.

INSERT INTO `alias` (`address`, `goto`, `name`, `moderators`, `accesspolicy`, `domain`, `created`, `modified`, `expired`, `active`) VALUES
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1);


5. Setting up Postfix

Back to the command line. We need to run:

postconf -e 'relay_domains ='
postconf -e 'mailman_destination_recipient_limit = 1'
/etc/init.d/postfix reload


6. Turn off Greylisting

Now you will probably want to turn off Greylisting. Greylisting simply returns all mail it receives from a new sender. If the sender tries to send again in a while, it's probably not a spam bot. It's very effective at stopping spam, but it often means delays between someone sending you a mail and you receiving it. In the case of Mailman, if the message to Mailman is delayed for an hour, it makes the system feel unresponsive - especially for new subscribers. It also makes testing a hassle. You don't need to turn it off - the next bit is optional.

Edit /etc/postfix-policyd.conf:

Now restart the Postfix policy thingy:

/etc/init.d/postfix-policyd restart


7. Configuring Mailman

We're going to tell Mailman to send mail from instead of However, all links it sends need to come from the domain. This is because we're going to set up a virtual domain just for Mailman.

pico /etc/mailman/

DEFAULT_URL_PATTERN = 'http://%s/'


8. Configuring Apache

We're almost done. We just need to configure the Apache server to serve the Mailman website whenever we go to Don't forget to set up this domain in /etc/hosts or your nameserver.

pico /etc/apache2/sites-available/mailman

ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/
Alias /pipermail/ /var/lib/mailman/archives/public/
Alias /images/mailman/ /usr/share/images/mailman/
<Directory /usr/lib/cgi-bin/mailman/>
    AllowOverride None
    Options ExecCGI
    AddHandler cgi-script .cgi
    Order allow,deny
    Allow from all
    Satisfy Any
<Directory /var/lib/mailman/archives/public/>
    Options FollowSymlinks
    AllowOverride None
    Order allow,deny
    Allow from all
<Directory /usr/share/images/mailman/>
    AllowOverride None
    Order allow,deny
    Allow from all
<VirtualHost *:80>
    DocumentRoot /var/www/lists
    ErrorLog /var/log/apache2/lists-error.log
    CustomLog /var/log/apache2/lists-access.log combined
    <Directory /var/lib/mailman/archives/>
        Options FollowSymLinks
        AllowOverride None
    Alias /pipermail/ /var/lib/mailman/archives/public/
    Alias /images/mailman/ /usr/share/images/mailman/
    ScriptAlias /admin /usr/lib/cgi-bin/mailman/admin
    ScriptAlias /admindb /usr/lib/cgi-bin/mailman/admindb
    ScriptAlias /confirm /usr/lib/cgi-bin/mailman/confirm
    ScriptAlias /create /usr/lib/cgi-bin/mailman/create
    ScriptAlias /edithtml /usr/lib/cgi-bin/mailman/edithtml
    ScriptAlias /listinfo /usr/lib/cgi-bin/mailman/listinfo
    ScriptAlias /options /usr/lib/cgi-bin/mailman/options
    ScriptAlias /private /usr/lib/cgi-bin/mailman/private
    ScriptAlias /rmlist /usr/lib/cgi-bin/mailman/rmlist
    ScriptAlias /roster /usr/lib/cgi-bin/mailman/roster
    ScriptAlias /subscribe /usr/lib/cgi-bin/mailman/subscribe
    ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
    ScriptAlias / /usr/lib/cgi-bin/mailman/listinfo

Now we just need to enable this virtual host.

a2ensite mailman
mkdir /var/www/lists
apache2ctl restart


9. Creating your first list

The first Mailman list is always "mailman". To create this list, run:

newlist mailman

Fill in your administrator's email address and password. It'll prompt you to hit Enter to notify the administrator. When you do this, you won't get an email immediately. We have one more step to do:

/etc/init.d/mailman start

Once we do that, the list administrator should get an email with a link to the admin interface of the new list.

If that works, you'll also want to test subscriptions (just send a blank mail to If you get a subscription confirmation back and you are able to click on the link, then most likely everything is working 100%. If not, panic! I mean, have a look at /var/log/mail.log to get an idea of what's going wrong.

Hint: to keep an eye on the mail log, use:

tail -f /var/log/mail.log

If you need to try to recreate the Mailman list, first run:

rmlist mailman


10. Creating more lists

To create a list called "listname", first add the new list's aliases to the aliases table in the MySql vmail database:

INSERT INTO `alias` (`address`, `goto`, `name`, `moderators`, `accesspolicy`, `domain`, `created`, `modified`, `expired`, `active`) VALUES
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1);

Once that's done, run this command to create a new list:

newlist listname

Have fun with your new Mailman server! I hope you create some great email communities.

Share this page:

8 Comment(s)

Add comment


From: Allan

Your tutorial is very excellent.

 In Mailman 2.1.13, the default request address is mailman-request@$domain.tld and not mailman-requests@$domain.tld, as your sql statement indicates.

To Fix:


('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
('', '', '', '', 'public', '', NOW(), NOW(), '9999-12-31 00:00:00', 1),
This is also indicated by the newaliases printout after the newlist command has been run:
To finish removing your mailing list, you must edit your /etc/aliases (or
equivalent) file by removing the following lines, and possibly running the
`newaliases' program:
## listname mailing list
listname: "|/var/lib/mailman/mail/mailman post listname"
listname-admin: "|/var/lib/mailman/mail/mailman admin listname"
listname-bounces: "|/var/lib/mailman/mail/mailman bounces listname"
listname-confirm: "|/var/lib/mailman/mail/mailman confirm listname"
listname-join: "|/var/lib/mailman/mail/mailman join listname"
listname-leave: "|/var/lib/mailman/mail/mailman leave listname"
listname-owner: "|/var/lib/mailman/mail/mailman owner listname"
listname-request: "|/var/lib/mailman/mail/mailman request listname"
listname-subscribe: "|/var/lib/mailman/mail/mailman subscribe listname"
listname-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe listname"

From: Anonymous

Thanks very much for your sharing. This tutorial is now linked in iRedMail web site: (Search "mailman" on this page)


Where shall I add "Mailman aliases"?  Where is "mailman" on phymyadmin?  Thanks

From: ross

Thank you.

I tested on VM and it's ok with iredmail + mysql.

Do you think that can work with iredmail+LDAP???


I'm sure it could work with LDAP. I did give it a try but I'm totally unfamiliar with LDAP so I just messed it up. 


From: Lucario

Thanks for a great tutorial! I've been looking to get mailing lists with my mysql-based iRedMail.


From: Tony

Thanks for this great tutorialI had one problem, resolved as below (I am using a Ubuntu server)

In step 8:

pico /etc/apache2/sites-available/mailman

should read:

pico /etc/apache2/sites-available/mailman.conf

otherwise a2ensite will return an error


From: gordon fielden


1054 - Unknown column 'defaultuserquota' in 'field list'