[Mailman-Users] Can we use an external mail server with mailman?

Mark Sapiro msapiro at value.net
Sun Oct 16 05:27:17 CEST 2005

game lover wrote:

>This is a topic I am interested in.  But can someone summarize these codes to make them simple so most people can following them easily?

I'm not sure what your issue is. The post you quote seems fairly self
explanatory to me, especially the part written by John Dennis, but
here's some information for you.

The python module ASMTPdirect.py which you quote has all it's
indentation removed so it doesn't have a chance of working. The
original can be found in the archive of this list at
but be aware that that code is based on Mailman 2.1.1. See below for
the patch if you need it.

There are actually two mail servers involved in operating Mailman. One
is the server that receives mail addressed to list at example.com,
list-bounces at example.com, etc. Call this the incoming MTA. The other
is the server that receives outgoing mail from Mailman such as posts
to be delivered to list members and administrative messages to be
delivered to list owners and moderators. Call this the outgoing MTA.

It is easy to configure the outgoing MTA to be anywhere. The mm_cfg.py
settings SMTPHOST and SMTPPORT specify the host name and port used to
access the outgoing MTA. Using an external outgoing MTA may be as
simple as specifying SMTPHOST = 'host_name' in mm_cfg.py.

The ASMTPdirect.py module comes into play if the external outgoing MTA
requires user/password authorization to accept mail for an arbitrary
destination. If this is required, you create
Mailman/Handlers/ASMTPDirect.py by patching
Mailman/Handlers/SMTPDirect.py with the patch below and you put the
following in mm_cfg.py

SMTP_USERNAME = 'username'
SMTP_PASSWORD = 'password'

Use of an external incoming MTA is more complex and requires the use of
something like fetchmail, perhaps in combination with other software,
on the Mailman box to retrieve the incoming mail from the external
system and pipe it properly to the mail wrapper. There is a way to use
a mail directory instead of the mail wrapper to deliver incoming mail
to Mailman which may simplify this process. See the settings and
comments for USE_MAILDIR in Defaults.py for information on this option.

Here is the patch to convert Mailman 2.1.6 SMTPDirect.py to
ASMTPDirect.py (watch out for wrapped lines). The patch for other
2.1.x versions is the same except for the line numbers of the second
--- SMTPDirect.py	2005-10-14 16:31:34.625000000 -0700
+++ ASMTPDirect.py	2005-10-15 19:53:39.234375000 -0700
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
-"""Local SMTP direct drop-off.
+"""Local SMTP direct drop-off w/Authtenication.
 This module delivers messages via SMTP to a locally specified daemon. 
 should be compatible with any modern SMTP server.  It is expected that
the MTA
@@ -61,6 +61,8 @@
     def __connect(self):
         self.__conn = smtplib.SMTP()
         self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)
+        if mm_cfg.SMTP_AUTH:
+            self.__conn.login(mm_cfg.SMTP_USERNAME,
         self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION
     def sendmail(self, envsender, recips, msgtext):

Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list