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: [EMAIL PROTECTED]
... From: [EMAIL PROTECTED]
... To: you
...
... The body
... """
>>> rcpts = ['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
>>> env = '[EMAIL PROTECTED]'
>>> 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 <[EMAIL PROTECTED]>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&amp;file=faq01.027.htp

Reply via email to