Revision 6 as of 2015-10-29 02:37:11

Clear message

Introduction

Running Mailman as a relay to your ISP's smtp server means that you can send out to moderate-sized mailing lists from your own Mailman server. The setup routes inbound list posts and requests from dedicated email accounts with your isp to your Mailman server. Outgoing posts are routed from your Mailman server to your isp's usual smtp server & thus out to the list members. This also circumvents the usual restrictions where your isp or dsl provider blocks port 25 preventing you from delivering mail yourself.

If your isp does not host Mailman accounts and if you do not wish to use a commercial service, then this a good way to consider running your own mailing list. For large lists with high traffic volumes this is not the setup you need. For one-way announcement lists, or moderate-sized local groupings, this can work well.

This is a dedicated setup that we describe here. Mailman runs unattended, mail comes in with Fetchmail and goes out with Postfix. The usual Mailman web administration facility is provided.

Since I have an Ubuntu server that is what this article revolves around. With other linux distros the principles are the same but specifics may vary. The Fetchmail and Postfix utilities mentioned here are Ubuntu defaults. Alternatives can be used if you are happier with them of course.

Briefly this requires the following:

  • that you normally access your email via POP3 from an isp using your regular email client (mutt, Claws, Pegasus, or any other).
  • that you run or provide a small linux server (a light duty database or file server will be fine).
  • that you are connected (24/7 desirable) to the internet through an adsl line
  • that you have easy (online is good) access to multiple email account creation through your isp.
  • that you have or provide a dns forwarding account for connecting to your server.
  • that you install or have installed already Fetchmail, Postfix, Apache, and of course Mailman.

If you just want to run a simple mailing list and  do not intend for yourself or others to access the Mailman subscription features from outside your network (ie, across the internet) then parts of this FAQ are redundant. You will have to interpret the unnecessary parts yourself at present. Not difficult.

We will assume that you want to set up a Mailman list called 'family-list'.

Overview, preliminaries, installation

Linux server

Any modest linux box will do. I run an old 800Mz box as a light duty office file and database server. I added Mailman on top of these duties which it carries without a blip. You will have to assess these needs yourself but for the light duties envisaged there is no need to go buying a high end dedicated server.

ADSL connection

I have the slowest bargain option running at 384bps. Everything runs quite zippy, we are not trying to squeeze humungous amounts of email along a slow line nor will infrequent web requests cause us hassle. My own use of the Mailman GUI configuration pages through my office server are as speedy as anything else I encounter. When I send out to my 2000 member mailing list then quite a large email is despatched in an hour or so. We don't need anything faster. The local cat charity mailing list is also hosted on there with a hundred plus members receiving monthly illustrated html mailings and this load is handled with no issues.

Email accounts

Each Mailman list uses 10 email addresses for various functions.
You need to establish accounts for each of these with your isp such that they forward all email received to the one account, mailman@mydomain, which is used to feed Mailman

The Fetchmail utility

This should be installed by default on a Ubuntu server. If for some reason this is not so then follow the usual Ubuntu installation procedures to have it installed.
Fetchmail connects to your isp and using the POP3 protocol with your username and password will download the email from the mailman@mydomain account and deliver this to the default port 25 as inbound email.

The Postfix utility

This should be installed by default on a Ubuntu server. If for some reason this is not so then follow the usual Ubuntu installation procedures to have it installed.
Postfix takes the input from Fetchmail on port 25 and delivers to Mailman. Subsequently it delivers the output from Mailman to your isp's smtp server.

DSL forwarding

If you want to access the Mailman GUI configuration and subscription interface externally from your server, such as from home, if you want to advertise an internet address for new subscribers, then you will need to do this. Your adsl line IP address may be dynamically allocated and thus change each time that you reconnect to the service, and perhaps on a timed basis also. Using a service such as dyndns.com you can create a (free) account to forward calls to your server from your account name which acts as your own '.com' address. Thus with an account named 'family.dyndns-remote.com' you can connect to the Mailman interface across the internet from home via the http protocol.
You will need to install a utility such as ddclient that will monitor your dynamically allocated WAN IP address and update changes back to your dyndns account. On your Ubuntu server from your user shell account you can issue this command.

$ sudo apt-get install ddclient

If you intend only to access the admin functions yourself from your own network, then this is not necessary.

Install Mailman

This package is not usually installed by default.
On your Ubuntu server from your user shell account you can issue this command.

$ sudo apt-get install mailman

The installation will run automatically and be finished in a very short while.

Create your first mailing list from your shell account using the interactive 'newlist' script. Check out the help first.

$ sudo /usr/lib/mailman/bin/newlist --help

You can add members with the add_members script or leave this until later when you can access the list via your browser.

Delivery rate and your ISP

Mailman can deliver emails at a prodigious rate. Your isp will have established various limits such as how many emails you can post per hour, per day, how many receipts per connection, to limit your input to his server to what he feels is reasonable. You should ascertain the current values from them and may need to take one of several options to limit the delivery output to within the specified limits. If you have a simple setup you might install the 'throttle patch' available from this Mailman wiki site to keep within specified limits. See the link at the end of this FAQ for details of this and other various throttling options more applicable to a larger installation with active two-way lists. If you have a 50-member family-list this may not be necessary, if you have a 2000-member list it is likely that you will exceed any stated limits. Check it out or you will end up on a worldwide spam list.

Install Apache web server

Generally installed on an Ubuntu server by default. If for some reason this is not so then follow the usual Ubuntu installation procedures to have it installed.

Finally

  1. You will need to configure fetchmail in ~/.fetchmailrc
  2. You will need to configure postfix in /etc/postfix/main.cf
  3. You will need to configure mailman in /etc/mailman/mm_cfg.py
  4. You will need to configure /etc/aliases and run newaliases
  5. You will need to configure /etc/ddclient.conf
  6. You will need to patch /usr/lib/mailman/Mailman/MailmanHandlers/SMTPDirect.py
  7. You may need to configure apache but the default ubuntu configuration seems to work well
  8. You may need to configure your router to route the incoming http requests to your server

Then ...

You will need to create and configure the mailman 'family-list' account configured to suit your needs. I suggest that you make a list first that you can use for testing the various settings both for the intended family-list and others that you may create in the future. Put several of your own addresses, some false addresses - one of which you can set for 'no mail' - as list members.

Configuration

Setup mail accounts

Create the following ten accounts with your isp. The first nine are set to 'forward' received mail into the last one.

family-list@mydomain
family-list-bounces@mydomain
family-list-confirm@mydomain
family-list-join@mydomain
family-list-leave@mydomain
family-list-owner@mydomain
family-list-request@mydomain
family-list-subscribe@mydomain
family-list-unsubscribe@mydomain
mailman@mydomain

There is no need to retain email in the first nine accounts, so aliasing without retention of mail is what is needed.

Configure the Fetchmail config file ~/.fetchmailrc

add in the new addresses & other stuff to fetch the emails.

set daemon 300
set syslog

poll pop3.at.your.isp with proto POP3
user 'mailman@mydomain' there with password 'ZBBmHKY'
to

'family-list@mydomain' = 'family-list'
'family-list-bounces@mydomain' = 'family-list-bounces'
'family-list-confirm@mydomain' = 'family-list-confirm'
'family-list-join@mydomain' = 'family-list-join'
'family-list-leave@mydomain' = 'family-list-leave'
'family-list-owner@mydomain' = 'family-list-owner'
'family-list-request@mydomain' = 'family-list-request'
'family-list-subscribe@mydomain' = 'family-list-subscribe'
'family-list-unsubscribe@mydomain' = 'family-list-unsubscribe'

Fetchmail will recognise changes as it reads .fetchmail on each invocation so no need to restart each time if you have to edit this

If you have more that one list, read the section "THE USE AND ABUSE OF MULTIDROP MAILBOXES" at http://www.fetchmail.info/fetchmail-man.html to ensure that posts that address more than one list don't result in duplicates.

Configure the Postfix config file /etc/postfix/main.cf

set these entries as necessary

myhostname = myservername.mydomain
mydestination = myservername.mydomain, localhost.mydomain, localhost
relayhost = myispsmtpserver

Configure the Mailman config file /etc/mailman/mm_cfg.py

set these entries as necessary

DEFAULT_EMAIL_HOST = 'mydomain'
DEFAULT_URL_HOST = 'family.dyndns-remote.com'
SMTP_MAX_RCPTS = 100 # the number of email addresses sent with one email at one smtp connection

Configure /etc/aliases

add these lines in. You will note that here the emails to the various addresses that are forwarded into family-list@myisp are now piped through to an appropriate Mailman command.

& then run

$ sudo newaliases

(Note that there is no ouput from this command).

Configure /etc/ddclient.conf

a basic configuration follows for a dyndns account, the last three lines would be specific to your account.

daemon=1000s
cache=/tmp/ddclient.cache
pid=/var/run/ddclient.pid
protocol=dyndns2
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
server=members.dyndns.org
login='login_name'
password='my_secret'
hostname_account

$ ddclient -help

will generate a large output with examples for various other forwarding dns accounts. If in doubt refer to the support pages of the service that you intend to use.

Patching SMTPDirect.py

NOTE: 24 Oct 2011 Mark Sapiro advises that use of Postfix in this case is sub-optimal, but this is where we have arrived at this moment. Throttling should ideally be implemented within the MTA used. In the case on which this HOWTO is based Postfix was already installed and running and the patched SMTPDirect.py does work without apparent adverse effects on the operation of postfix??

Download throttle.patch from the link given to install the needed changes. The syntax from the download directory to install this should be:

$ patch /usr/lib/mailman/Mailman/Handlers/SMTPDirect throttle.patch

edit the following values which the patch has now inserted into SMTPDirect.py to comply with your isp's restrictions on hourly/daily limits. Look for the following section near the top of the file.

# Throttling settings. Do not send to more than THROTTLE_LIMIT recipients
# within THROTTLE_TIME seconds. Set THROTTLE_LIMIT to 0 to not throttle.
THROTTLE_TIME = 60
THROTTLE_LIMIT = 30
THROTTLE_DATA = [ ]

The values shown represent a limit of 1800 emails per hour, well inside my isp's limit of 3000; be conservative as you do not know how your isp will do the counting.
Note that the THROTTLE_LIMIT overrides the value set for SMTP_MAX_RCPTS = 100 in /etc/mailman/mm_cfg.py

Configuring your router

You may have to configure your router to pass incoming http requests to port 80.  If you have multiple computers on your network this is certain. Refer to the router manual as this is beyond the scope of this FAQ. Usually the router is accessed from your browser using the ip address provided making this not-too-difficult operation. (My router allows this under Advanced Configuration/NAT/virtual servers,  - Network Address Translation?),

Hacking it to go!

With all the hard work done one might hope for it to work out of the box! Note, we do not deal with mailman configuration specifics here, they are dealt with in detail elsewhere in Mailman documentation and FAQs.

Fire the browser up

Point your browser to something like

http://www.family.dyndns-remote.com/cgi-bin/mailman/admin/family-list

or if you are accessing this from your own network, then something like

192.168.0.15/cgi-bin/mailman/admin/family-list

If you want to use the server name instead of the ip address then you will need an appropriate entry in /etc/hosts

Configure the list to suit your needs, then add in email addresses and finally make a post to the list from one of them.

Check the mail log

If you want to see what happens have a terminal open on the server and tail the log file

$ sudo tail -f /var/log/mail.log

so you can see the mail in and out and the interaction of Fetchmail & Postfix. You should see Fetchmail fetch the mail from family-list@mydomain , then see it forwarded in to Mailman by Postfix, and then out from Postfix to your the list addresses via your isp's smtp server. Hopefully you can then POP your own copy down from your isp with your usual email client.

Hiccups

You will have to start the fetchmail daemon by hand if your server shuts down and restarts. I have failed to get this going automagically, probably because fetchmail is installed for me as a user.

$ fetchmail

You may find a /var/mail/fetchmail postbox created if mail is not delivered correctly so you can check that out for clues to failure.

If you later change your dns account (say, from dyndns to activedns) then you must edit mm_cfg.py as noted above to reflect your new dns address. You will also have to run the fix_url script. If you find issues with accessing member lists on the 0-9A-Z Membership Lists page then this has to be done, if you get dumped back at the login page, this has to be done.  There are several appropriate FAQ entries documenting this and other occurring issues if this is not done. Look at FAQs 4.52 & 4.69 for info on what you need to do.

My network has fixed ip addresses for each machine. I do not use dynamic ip addresses. Right now you are on your own, but surely not a major issue.

VERP delivery

This is a measure designed to improve bounce detection rate. It relies upon the smtp server supporting the use of a recipient delimiter ('recipient_delimiter = +' in the Postfix configuration file main.cf). This is a contentious issue on account of performance hits if implemented in Mailman itself, but it can instead be implemented in Postfix (although not in all MTA's). In any event you may find, as I did, that your isp's smtp server does not support this option. For a small list where you know everybody it is hardly worthwhile, for a large list it may be a necessity to reduce the flow of unrecognised bounces which in any case is outside of the discussion of this FAQ.

Conclusion

You may need to tweak various configuration settings, but what we have here is taken from a working installation. The mailman-users list is populated with clever helpful people. If your RTFM efforts do not solve a problem there are few issues that cannot get a well-informed reply from the list.

Good luck!

List of relevant links

... which may be of help either in solving installation issues or in understanding them.

A simpler outline which sparked my interest in having my own Mailman installation. http://www.freesoftwaremagazine.com/articles/running_gnu_mailman_at_home

from the Mailman users FAQ, a discussion of the issues surrounding throttling in mailman versus throttling in your MTA http://wiki.list.org/pages/viewpage.action?pageId=4030607

from the official Mailman installation documentation, the use of Postfix's own alias database is laid outhttp://list.org/mailman-install/postfix-integration.html

from the Mailman users FAQ, a discussion of group mismatch errors that might arise if you change from the /etc/aliases setup discussed above to the use of Postfix's own alias database. http://wiki.list.org/display/DOC/Understanding+group+mismatch+errors+-+how+mailman+implements+security

from the official Mailman installation documentation, notes on possible use of VERP deliveryhttp://list.org/mailman-install/node12.html

from the Mailman users FAQ, an extended discussion of the issues surrounding the use of VERP delivery http://wiki.list.org/pages/viewpage.action?pageId=4030583

from the Postfix people http://www.postfix.org/VERP_README.html#smtp

Postscript

Having installed the various utilities described I have since made use of them for some of my email accounts - mostly technical mailing lists - which are now handled by Postfix and Fetchmail to be stored on the server for reading with mutt which I access via an ssh connection from home.

Thanks to Mark Sapiro and others on the mailman-users mailing list for their time and help.

Originally posted by 'anotheranne March 19 2012.

Updated by 'anotheranne' May 2014