[Mailman-Users] Qmail users, never create another alias for Mailman lists!
bruce at hams.com
bruce at hams.com
Sun Mar 14 20:08:33 CET 1999
Here is a Python script that operates Mailman in a qmail virtual domain.
There's no need to create any aliases when you make a new list, the script
catches all mail for the virtual domain and figures out what list it goes to.
It handles mail to postmaster, abuse, root, and mailer-daemon in the virtual
domain by forwarding that mail to a responsible person (by default
postmaster at localhost). It handles mail to non-existent addresses (misspelled
lists, majordomo, etc.) by bouncing the mail with a suggestion to try the list
See the installation instructions under "INSTALLATION" in the
script comments. I'm currently using this on lists.hams.com . Once other
people have had a chance to test it, I'll submit it for distribution with
Mailman. Thus, please tell me if you try it out.
This should be portable to Witesse's Postfix (IBM "Secure Mailer") with minor
changes, and possibly other mailers.
--- cut here ---
# Configuration variables - Change these for your site if necessary.
MailmanHome = "/home/mailman"; # Mailman home directory.
MailmanOwner = "postmaster at localhost"; # Postmaster and abuse mail recepient.
# End of configuration variables.
# Interface mailman to a qmail virtual domain. Does not require the creation
# of _any_ aliases to connect lists to your mail system.
# Bruce Perens, bruce at hams.com, March 1999.
# This script is meant to be called from ~mailman/.qmail-default . It catches
# all mail to a virtual domain, in my case "lists.hams.com". It looks at the
# recepient for each mail message and decides if the mail is addressed to a
# valid list or not, and bounces the message with a helpful suggestion if it's
# not addressed to a list. It decides if it is a posting, a list command, or
# mail to the list administrator, by checking for the -admin, -owner, and
# -request addresses. It will recognize a list as soon as the list is created,
# there is no need to add _any_ aliases for any list. It recognizes mail to
# postmaster, mailman-owner, abuse, mailer-daemon, root, and owner, and
# routes those mails to MailmanOwner as defined in the configuration
# variables, above.
# Install this file as ~mailman/qmail-to-mailman.py
# To configure a virtual domain to connect to mailman, create these files:
# |/usr/bin/python /home/mailman/mail-in.py
# Replace DOMAIN.COM above with the name of the domain to be connected to
# Mailman. Note that _all_ mail to that domain will go to Mailman, so you
# don't want to put the name of your main domain here. In my case, I created
# lists.hams.com for Mailman, and I use hams.com as my regular domain.
# After you edit /var/qmail/control/virtualdomains, kill and restart qmail.
import sys, os, re, string;
os.nice(5); # Handle mailing lists at non-interactive priority.
os.chdir(MailmanHome + "/lists");
local = os.environ["LOCAL"];
# This might happen if we're not using qmail.
sys.stderr.write("LOCAL not set in environment?\n");
local = re.sub("^mailman-","",local);
names = ("root", "postmaster", "mailer-daemon", "mailman-owner", "owner", "abuse");
for i in names:
if i == local:
type = "post";
types = (("-admin$", "mailowner"),
for i in types:
type = i;
local = re.sub(i,"",local);
os.execv(MailmanHome + "/mail/wrapper"
,(MailmanHome + "/mail/wrapper", type, local));
bounce_message = """\
TO ACCESS THE MAILING LIST SYSTEM: Start your web browser on
That web page will help you subscribe or unsubscribe, and will
give you directions on how to post to each mailing list.\n""";
sys.stderr.write(bounce_message % (os.environ["HOST"]));
except SystemExit, argument:
except Exception, argument:
info = sys.exc_info();
trace = info;
sys.stderr.write("%s %s\n" % (sys.exc_type, argument));
sys.stderr.write("Line %d\n" % (trace.tb_lineno));
sys.exit(111); # Soft failure, try again later.
--- cut here ----
More information about the Mailman-Users