[Mailman-Users] HowTo Notes - Mailman and Sendmail Integration

Tony Lembke tony at lemlink.com.au
Mon Dec 31 09:33:38 CET 2007


I've recently spent a fair deal of time integrating mailman with  
sendmail to automate the creation of alias files.
A number of postings to this list were helpful.
It's all working now, so I thought my notes may be helpful to speed  
things up for someone else.
I apologise if there are any mistakes or false steps.

Thanks to the Mailman developers and Ed Greenberg

To be read in conjunction with the mailman installation instructions at
<http://www.gnu.org/software/mailman/mailman-install/index.htm>
and the post by Ed Greenberg at
<http://mail.python.org/pipermail/mailman-users/2004-June/037518.html>

-------------
Step 1
I'm using Apache2, Mailman 2.19 and FreeBSD4 and Python 2.4

-------------
Step 2
As root
#adduser
I used -> user: mailman, group:mailman, password: n

-------------
Step 3
create Installation Directory (as root)
su#  cd /usr/local/
su#  mkdir mailman
su#  chown mailman mailman
su# su mailman
su# cd mailman
su# chgrp mailnull .
su# chmod a+rx,g+ws .

-------------
Step 4
Now, go to the directory where you have downloaded mailman

su# cd /usr/home/xxxxx/mailman-2.1.9

Change back to user root
su# su root

You can ascertain the correct option for --with-mail-gid from /etc/ 
mail/sendmail.cf
su# grep "DefaultUser" /etc/mail/sendmail.cf
=> #O DefaultUser=mailnull
So use mailnull

su#  su root
su#   make clean
su#  configure --with-mail-gid=mailnull
I'm on FreeBSD so use this command
su# make DIRSETGID=: install

Now check permissions
su# cd /usr/local/mailman
su# bin/check_perms -f

My webserver runs as nobody (check httpd.conf on your system to confirm)
su# grep "User " /usr/local/apache2/conf/httpd.conf
=> User nobody

su# cd archives
su# chown nobody private
su# chmod o-x private

-------------
Step 5
Add this to your httpd-vhosts.conf, or httpd.conf depending on which  
version of Apache you are using

<VirtualHost *:80>
ServerName lists.practiceimprovement.com.au
TransferLog /dev/null
DocumentRoot /usr/home/lists/htdocs/
ScriptAlias /mailman/ /usr/local/mailman/cgi-bin/
Alias   /pipermail/ /usr/local/mailman/archives/public/
</VirtualHost>

and restart apache

-------------
Step 6
Integrating sendmail and mailman

mm-handler would not work for me (after considerable amount of time  
trying) - I think because by server was medicine.net.au and the  
address I wanted to use was practiceimprovement.org.au,
even though practiceimprovement.org.au was correctly set up on dns to  
be delegated to the right server.

So I used Ed Greenberg's approach at
<http://mail.python.org/pipermail/mailman-users/2004-June/037518.html>
which seems better to me.

Note: On Freebsd I first had to build sudo!

create the file /usr/sbin/mailman.aliases c
su# pico /usr/bin/mailman.aliases
containing the lines below =>

/bin/cp /usr/local/mailman/data/aliases /etc/mail/mailman.aliases
/usr/bin/newaliases

Note: I spent a lot of time bugtesting as I used 'cp' in the  
mailman.aliases script rather than /usr/cp
(it worked from the command line but not the web interface)

make it executable
su# chmod 755 /usr/sbin/mailman.aliases

Change your sendmail.cf file to include the new alias file
(for me, add this to medicine.net.au.mc)
define(`ALIAS_FILE', `/etc/mail/aliases,/etc/mail/mailman.aliases')
(and then as root)
su# /etc/mail/make install restart

Update your sudoers file ('nobody' is the user apache runs under -  
check your httpd.conf)
su# visudo
add=>
nobody ALL= NOPASSWD: /usr/local/sbin/mailman.aliases
mailman ALL= NOPASSWD: /usr/local/sbin/mailman.aliases

-------------
Step 7
my mm_cfg.py has these added

DEFAULT_EMAIL_HOST = 'practiceimprovement.com.au'
DEFAULT_URL_HOST = 'lists.practiceimprovement.com.au'
DEFAULT_URL_PATTERN = 'http://%s/mailman/'
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
IMAGE_LOGOS = '/images/'
MTA='Postfix'
POSTFIX_ALIAS_CMD = '/usr/local/bin/sudo /usr/local/sbin/ 
mailman.aliases'
POSTFIX_STYLE_VIRTUAL_DOMAINS = []

Follow the rest of the instructions from step 7 on at ->
<http://www.gnu.org/software/mailman/mailman-install/index.html>
-----------------
Testing
When you create a list using /bin/newlist, you should find that the  
file /etc/mail/mailman.aliases has been created / updated.
(I had some permissions to sort out in a few directories before it all  
worked smoothly)
The error log is helpful at /usr/local/mailman/logs/error

These commands can be helpful for troubleshooting, after you have  
successfully created a testlist and subscribed yourself to that list

To test mailman

su# echo "From: tony at pi.com.au
To: testlist at pi.com.au
Subject: Happy New Year
test mail body
" | /usr/local/mailman/mail/mailman post testlist

If that works, use this to test your sendmail/mailman integration

su# echo "From: tony at pi.com.au
To: testlist at pi.com.au
Subject: Merry Xmas
test mail body
" | /bin/sendmail -tony at pi.com.au testlist at pi.com.au

Hope this helps someone and would welcome corrections or improvements.

Happy New Year,

Tony Lembke









More information about the Mailman-Users mailing list