Apr 142006

Mailman – additional virtual domains

In a recent Mailman article, we learned how to install and configure Mailman with Postfix on FreeBSD. We added a single virtual domain, lists.freebsddiary.org. Today, I’ll add in lists.freshports.org. NOTE: to avoid the spambots, I have changed some instances of lists.freshports.org to lists.example.org. Please keep that in mind. NOTE: this article assumes you have set Mailman up as shown in the previous article.

Creating the new list

To create the new list:
cd /usr/local/mailman
bin/newlist --urlhost=lists.freshports.org \
    --emailhost=lists.freshports.org freshports-beta
This will send out a list creation email such as this:
The mailing list `freshports-beta' has just been created for you.  The
following is some basic information about your mailing list.

Your mailing list password is:


You need this password to configure your mailing list.  You also need
it to handle administrative requests, such as approving mail if you
choose to run a moderated list.

You can configure your mailing list at the following web page:


The web page for users of your mailing list is: 


You can even customize these web pages from the list configuration
page.  However, you do need to know HTML to be able to do this.

There is also an email-based interface for users (not administrators)
of your list; you can get info about using it by sending a message
with just the word `help' as subject or in the body, to:


To unsubscribe a user: from the mailing list 'listinfo' web page,
click on or enter the user's email address as if you were that user.
Where that user would put in their password to unsubscribe, put in
your admin password.  You can also use your password to change
member's options, including digestification, delivery disabling, etc.

Please address all questions to mailman-owner@havoc.example.org.
In this email, the URLs refer to havoc.example.org, which is the hostname of the system on which I installed Mailman. The URL should be lists.freshports.org. I will fix that with this command:
bin/withlist -l -r fix_url freshports-beta --urlhost=lists.freshports.org
With this change, I was able to browse to the mailman interface and see the lists: http://lists.freshports.org/mailman/listinfo

Making email work

I then tried to send email to the list. It failed:
This is the Postfix program at host m21.unixathome.org.

I'm sorry to have to inform you that your message could not be
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to 

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

			The Postfix program

<freshports-beta@lists.example.org>: host lists.example.org[]
    said: 550 <freshports-beta@lists.example.org>: Recipient address
    rejected: User unknown in virtual alias table (in reply to RCPT TO command)
Ahh yes, of course, I didn’t tell Postfix about this new domain it must handle. To fix the above, I added this entry to /usr/local/etc/postfix-config/transport:
lists.freshports.org mailman:
After making any changes to this file, you need to refresh the database:
postmap /usr/local/etc/postfix-config/transport
I also let Postfix know that it should accept mail for lists.freshports.org by adding this entry to /usr/local/etc/postfix/main.cf:
relay_domains = lists.freebsddiary.org, lists.freshports.org
If you already have a relay_domains entry, add to it. Do not replace. With that change, mail for that mailing list worked!

  One Response to “Mailman – additional virtual domains”

  1. Nice article, thanks for publishing it!

    I have a minor suggestion to add, instead of having to define the lists domains in both the relay_hosts variable and in the transport file, eg:

    # in main.cf:
    relay_domains = lists.freebsddiary.org, lists.freshports.org
    transport_maps = hash:/usr/local/etc/postfix-config/transport

    # in transport:
    lists.freebsddiary.org mailman:
    lists.freshports.org mailman:

    I usualy just define the domains inside the transport file, and also use that file in the relay_domains variable, eg:

    # in main.cf:
    relay_domains = hash:/usr/local/etc/postfix-config/transport
    transport_maps = hash:/usr/local/etc/postfix-config/transport

    # in transport:
    lists.freebsddiary.org mailman:
    lists.freshports.org mailman:

    This works because we take advantage on the fact that relay_hosts is a list, and Postfix only looks at the left side of lists; this is described under the "Postfix lists versus tables" section at <http://www.postfix.org/DATABASE_README.html&gt;.