[Mailman-Users] Outbound smtp email problems (qmail problems)

Mark Sapiro msapiro at value.net
Tue May 17 03:57:56 CEST 2005

Matt England wrote:
>Care to offer any suggestions about how I can isolate these php-to-qmail 
>and python-to-qmail problems...with like test scripts?  How do I write it, 
>and/or do simple, stand-alone scripts already exist?  Can someone write me one?

The following is an example of an interactive python session that sends
a message to two recipients in exactly the same way that SMTPDirect.py
does. Actual addresses and domains have been munged for privacy, but
the session works and causes the message to be sent via the smtp
server at 'localhost' via the default port (port = 0 to the connect
method says use the default which is 25).

The values assigned to SMTPHOST and SMTPPORT are from Defaults.py. If
you find you need to change them in any way to make this work, make
the same changes in mm_cfg.py.

msg can be as elaborate as you want.
the rcpts list should contain valid recipients - this is the only
change required for it to actually send mail.

$ python
Python 2.3.3 (#1, May  7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import smtplib
>>> msg = """Subject: Test Message
... Message-Id: some-id at nowhere.example.com
... From: poster at example.com
... To: you
... The body
... """
>>> rcpts = ['user1 at example.com', 'userb at example.com']
>>> env = 'list-bounces at example.com'
>>> SMTPHOST = 'localhost'
>>> SMTPPORT = 0
>>> x = smtplib.SMTP()
>>> x.connect(SMTPHOST, SMTPPORT)
(220, 'sb7.example.com ESMTP Sendmail 8.12.11/8.12.11; Mon, 16 May 2005
18:08:07 -0700')
>>> x.sendmail(env, rcpts, msg)
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