majordomo and virtual mailing lists

majordomo and virtual mailing lists

One great strength of majordomo is the ability to run virtual mailing lists, like
and, from the same machine.

If you want to know more
about virtual machines, see

The resources

As with everything, I don’t figure these things out on my own.  I use what
someone else has already written.  In this case, I’ve used the majordomo FAQ which
contains a section on virtual
.   From there, it refers to Ernest
extremely useful article on Configuring Virtual


I will assume you have already configured sendmail to handle virtual domains.
  I used Jim Mock’s article on sendmail Virtual
Hosting.  I found it very easy, using that article, to add virtual sendmail
domains to my machine.  I will also assume you have already installed

For this example, you are creating the mailing list

A new majordomo configuration file

I created a new config file for the virtual domain (if you already have
other virtual domains sitting around, you could use that majordomo configuration file as a starting point) :

# cd /usr/local/majordomo
# cp
# chown majordom:majordom

Then I modified the new file to contain these values:

$whereami = "";
$listdir = "$homedir/lists/$whereami";
$digest_work_dir = "$homedir/lists/$whereami/digests";
$log = "$homedir/lists/$whereami/Log";

New virtual users

These are the aliases you need to add to /etc/mail/virtusertable.   A
template is available from samples/majordomo.virtusertable.txt.
  Make the changes as shown in the comments at the top of the file.

Here is what
you can find in the template.

#       owner-majordomo-yourdomain-com       owner-majordomo-yourdomain-com             majordomo-yourdomain-com

The following is needed for each list in a given virtual domain:

# yourlist mailing list
#        owner-yourlist-yourdomain-com        owner-yourlist-yourdomain-com              yourlist-yourdomain-com      yourlist-yourdomain-com-request     yourlist-yourdomain-com-approval

If you have a digest version of your list, you’ll need one of the above sections for
the list and another one for the digest.

After you add these entries, you need to build the virtual user database.  To do
so, run the following command:

makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable

A new majordomo alias file

We will now create an alias file which defines both mojordomo for this domain and
the mailing list. This file defines aliases for a digest.  A template is
example in a separate file because the lines are very long.  Use the template text
available from sample/majordomo.alias.txt.

As you example that template, let’s assume the following:

  • your list name is mountainbikes
  • your domain name is
  • the list owner is

If that is the case, then you need to make the following changes to the template data:

original text

new text





This file goes in /etc/mail. Name it

You will also need to add this file to /etc/mail/, or, if you are using it,
your sendmail.m4 file (see following sections for details). Here’s an example:

 location of alias file
O AliasFile=/etc/mail/aliases,/etc/mail/

After creating the file and updating, remember to run newaliases. See the next sections
for details.

Tell sendmail about the majordomo aliases

Now that we have created these majordomo aliases, we need to make sure that sendmail
knows about them.  We do that by modifying the our .mc file.  
Instructions for modifying your .mc file are included in the upgrading sendmail article.  In short,
here’s what you do:

# cd /usr/ports/mail/sendmail-8.9.3/cf/cf/

.mc files are normally of the form, where hostname is the name of your
machine.  If you don’t have a .mc file, you are welcome to use samples/ from my
system.  You will need to edit this file and ensure the following appears in that

# The aliases after installing  majordomo

WARNING: the above "define" example should be all on one line.  It
appears as two lines above to keep the page narrow.

The key point here is that you add the alias file which you created in the previous

Now you need to generate your new file:

# m4 ../m4/cf.m4 >
# cp /etc/ /etc/
# cp /etc

Create new aliases

After adding new aliases, you must recreate the alias database.  This is done
simply by issuing the following command:

# newaliases

You should check for errors by doing the following:

# tail /var/log/messages

The following indicates a successful run:

sendmail[90764]: alias database /etc/aliases.majordomo rebuilt by peter
sendmail[90764]: /etc/aliases.majordomo: 31 aliases, longest 118 bytes,
                                                       1834 bytes total

Creating directories

If you created a digest for your list, you’ll have to create and chown the respective
directoires.  I originally did this in Creating a digest and
archive for a majordomo mailing list
but I’ve copied the relevent bits here.  
Again, subsitute as appropriate for your situation.

# Let's assume the following:
#        your list name is mountainbikes
#        your domain name is
# Then you need to make the following changes:
#    original text             new text
#    yourlist                  mountainbikes

mkdir /usr/local/majordomo/lists/
chown majordom /usr/local/majordomo/lists/
mkdir /usr/local/majordomo/lists/
chown majordom /usr/local/majordomo/lists/
chmod 750 /usr/local/majordomo/lists/
mkdir /usr/local/majordomo/lists/
chown majordom /usr/local/majordomo/lists/
chmod 750 /usr/local/majordomo/lists/

Restart sendmail and check for errors

After all of this work, it’s time to restart sendmail so it can take notice
of the new aliases you have created.

# killall -HUP sendmail

Check for any errors by doing this:

# tail /var/log/maillog

If it looks something like this, then you’re OK

ns sendmail[90896]: restarting /usr/sbin/sendmail on signal
ns sendmail[90901]: starting daemon (8.9.3): SMTP+queueing@00:15:00

Creating a new list

For this example, I’ll be using my creation of the New Zealand FreeBSD User Group (nzfug)
mailing list. The address we want to use for subscribing is These steps will put all mailing lists relating to a given domain
in the directory
Remember this point when it comes time to configure majordomo in the
following sections.

  1. cd /usr/local/majordomo/lists
  2. mkdir
  3. chown majordom:majordom
  4. cd
  5. touch mountainbikes
  6. chown majordom:majordom mountainbikes
  7. chmod 640 mountainbikes
  8. echo 'config mountainbikes mountainbikes.admin' | mail

    If you are creating virtual domains or if you are not on the box on which
    majordomo resides, then you need to specify the domain in the mail message (i.e.

  9. Modify newlist.config which the previous step created. Change
    passwords, add footers, etc. You may also wish to see my list of Commonly Changed Configuration Items.
  10. echo 'subscribe mountainbikes' | mail
  11. Respond to any email that majordomo sends back to you. This is normally
    confirmation that you have supplied a valid email address and that you are subscribing
    yourself and not somebody else.
  12. test the list by send a message to the list at


With all that work, you should now be able to use your virtual mailing lists. 
Try subscribing.  See what happens.  Remember, when you subscribe, you need to
send to

I’ve just rewritten large portions of
this article.  If you notice any omissions or errors, please add your comments.

Leave a Comment

Scroll to Top