473,659 Members | 2,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Roundup, smtplib, TLS and MS Exchange

Hi,

I'm using the roundup issue tracker (http://roundup.sourceforge.net)
which uses smtplib to send mail. It all worked until we moved to a
hosted Exchange MTA. The hosting provider requires the use of TLS. Now
roundup can't send mail.

My version of python is:
Python 2.3.4 (#1, Feb 6 2006, 10:38:46)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2

Roundup version:
$ roundup-server --version
1.1.2 (python 2.3.4)

I've reproduced the SMTP conversation below. I'm not sure if it's a
problem with Roundup, smtplib, or Exchange.

Any assistance appreciated.

[foobar@moe tracker]$ roundup-server -p 8081
roundup=/home/foobar/roundup/tracker
Roundup server started on :8081
send: 'STARTTLS\r\n'
reply: '503 5.5.2 Send hello first\r\n'
reply: retcode (503); Msg: 5.5.2 Send hello first
send: 'ehlo moe.foobar.loca l\r\n'
reply: '250-smtpx15.msoutlo okonline.net Hello [202.173.131.223]\r\n'
reply: '250-SIZE 31457280\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-ENHANCEDSTATUSC ODES\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-AUTH LOGIN\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-BINARYMIME\r\n'
reply: '250 CHUNKING\r\n'
reply: retcode (250); Msg: smtpx15.msoutlo okonline.net Hello [202.173.131.223]
SIZE 31457280
PIPELINING
ENHANCEDSTATUSC ODES
STARTTLS
AUTH LOGIN
8BITMIME
BINARYMIME
CHUNKING
send: 'AUTH LOGIN ************==\ r\n'
reply: '334 ************\r\ n'
reply: retcode (334); Msg: ************
send: '************\r \n'
reply: '235 2.7.0 Authentication successful\r\n'
reply: retcode (235); Msg: 2.7.0 Authentication successful
send: 'mail FROM:<us**@doma in.comsize=1090 \r\n'
reply: '451 5.7.3 Must issue a STARTTLS command first\r\n'
reply: retcode (451); Msg: 5.7.3 Must issue a STARTTLS command first
send: 'rset\r\n'
send: 'STARTTLS\r\n'
reply: '503 5.5.2 Send hello first\r\n'
reply: retcode (503); Msg: 5.5.2 Send hello first
send: 'ehlo moe.foobar.loca l\r\n'
reply: '250-smtpx15.msoutlo okonline.net Hello [202.173.131.223]\r\n'
reply: '250-SIZE 31457280\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-ENHANCEDSTATUSC ODES\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-AUTH LOGIN\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-BINARYMIME\r\n'
reply: '250 CHUNKING\r\n'
reply: retcode (250); Msg: smtpx15.msoutlo okonline.net Hello [202.173.131.223]
SIZE 31457280
PIPELINING
ENHANCEDSTATUSC ODES
STARTTLS
AUTH LOGIN
8BITMIME
BINARYMIME
CHUNKING
send: 'AUTH LOGIN *************** *************** ==\r\n'
reply: '334 ************\r\ n'
reply: retcode (334); Msg: ************
send: '************\r \n'
reply: '235 2.7.0 Authentication successful\r\n'
reply: retcode (235); Msg: 2.7.0 Authentication successful
send: 'mail FROM:<us**@doma in.comsize=1711 \r\n'
reply: '451 5.7.3 Must issue a STARTTLS command first\r\n'
reply: retcode (451); Msg: 5.7.3 Must issue a STARTTLS command first
send: 'rset\r\n'
192.168.100.68 - - [31/May/2007 16:14:01] "POST /roundup/issue1638
HTTP/1.1" 400 -
EXCEPTION AT Thu May 31 16:14:01 2007
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/roundup/scripts/roundup_server. py",
line 106, in run_cgi
self.inner_run_ cgi()
File "/usr/lib/python2.3/site-packages/roundup/scripts/roundup_server. py",
line 266, in inner_run_cgi
tracker.Client( tracker, self, env).main()
File "/usr/lib/python2.3/site-packages/roundup/cgi/client.py", line
196, in main
self.inner_main ()
File "/usr/lib/python2.3/site-packages/roundup/cgi/client.py", line
314, in inner_main
self.mailer.exc eption_message( )
File "/usr/lib/python2.3/site-packages/roundup/mailer.py", line 153,
in exception_messa ge
self.standard_m essage(to, subject, content)
File "/usr/lib/python2.3/site-packages/roundup/mailer.py", line 93,
in standard_messag e
self.smtp_send( to, message)
File "/usr/lib/python2.3/site-packages/roundup/mailer.py", line 180,
in smtp_send
raise MessageSendErro r("Error: couldn't send email: %s"%msg)
MessageSendErro r: Error: couldn't send email: Connection unexpectedly closed
Jun 1 '07 #1
2 6130
carlistixx wrote:
[foobar@moe tracker]$ roundup-server -p 8081
roundup=/home/foobar/roundup/tracker
Roundup server started on :8081
send: 'STARTTLS\r\n'
reply: '503 5.5.2 Send hello first\r\n'
reply: retcode (503); Msg: 5.5.2 Send hello first
I think this must be an issue with roundup, issuing commands in the wrong
order. The correct order should (according to the rfc and the python docs)
be:
* ehlo()
* starttls()
* ehlo()
* login()
....

--

Regards,
Tijs
Jun 1 '07 #2
Thanks for your response. I tried modifying the Roundup code as suggested:

class SMTPConnection( smtplib.SMTP):
''' Open an SMTP connection to the mailhost specified in the config
'''
def __init__(self, config):

smtplib.SMTP.__ init__(self, config.MAILHOST )
self.set_debugl evel(1)
# start the TLS if requested
if config["MAIL_TLS"]:
self.ehlo()
self.starttls(c onfig["MAIL_TLS_KEYFI LE"],
config["MAIL_TLS_CERTF ILE"])
self.ehlo()

# ok, now do we also need to log in?
mailuser = config["MAIL_USERN AME"]
if mailuser:
self.login(mail user, config["MAIL_PASSW ORD"])

I've inserted a call to ehlo() before and after the call to
starttls(). Adding the first call to ehlo() does help - I don't get so
many complaints from the server. But it still doesn't work- it seems
like the server stops responding after the call to starttls().

I have not specified a keyfile or certfile in the Roundup
configuration, but as I understand it these are optional, so I presume
this is not causing the problem.

[foobar@moe tracker]$ roundup-server -p 8081
roundup=/home/foobar/roundup/tracker
Roundup server started on :8081
send: 'ehlo moe.foobar.loca l\r\n'
reply: '250-smtpx15.msoutlo okonline.net Hello [202.173.131.223]\r\n'
reply: '250-SIZE 31457280\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-ENHANCEDSTATUSC ODES\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-AUTH LOGIN\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-BINARYMIME\r\n'
reply: '250 CHUNKING\r\n'
reply: retcode (250); Msg: smtpx15.msoutlo okonline.net Hello [202.173.131.223]
SIZE 31457280
PIPELINING
ENHANCEDSTATUSC ODES
STARTTLS
AUTH LOGIN
8BITMIME
BINARYMIME
CHUNKING
send: 'STARTTLS\r\n'
reply: '220 2.0.0 SMTP server ready\r\n'
reply: retcode (220); Msg: 2.0.0 SMTP server ready
send: 'ehlo moe.foobar.loca l\r\n'
send: 'ehlo moe.foobar.loca l\r\n'
reply: '250-smtpx15.msoutlo okonline.net Hello [202.173.131.223]\r\n'
reply: '250-SIZE 31457280\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-ENHANCEDSTATUSC ODES\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-AUTH LOGIN\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-BINARYMIME\r\n'
reply: '250 CHUNKING\r\n'
reply: retcode (250); Msg: smtpx15.msoutlo okonline.net Hello [202.173.131.223]
SIZE 31457280
PIPELINING
ENHANCEDSTATUSC ODES
STARTTLS
AUTH LOGIN
8BITMIME
BINARYMIME
CHUNKING
send: 'STARTTLS\r\n'
reply: '220 2.0.0 SMTP server ready\r\n'
reply: retcode (220); Msg: 2.0.0 SMTP server ready
send: 'ehlo moe.foobar.loca l\r\n'
192.168.100.68 - - [04/Jun/2007 10:43:24] "POST /roundup/issue1638
HTTP/1.1" 400 -
EXCEPTION AT Mon Jun 4 10:43:24 2007
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/roundup/scripts/roundup_server. py",
line 106, in run_cgi
self.inner_run_ cgi()
File "/usr/lib/python2.3/site-packages/roundup/scripts/roundup_server. py",
line 266, in inner_run_cgi
tracker.Client( tracker, self, env).main()
File "/usr/lib/python2.3/site-packages/roundup/cgi/client.py", line
196, in main
self.inner_main ()
File "/usr/lib/python2.3/site-packages/roundup/cgi/client.py", line
314, in inner_main
self.mailer.exc eption_message( )
File "/usr/lib/python2.3/site-packages/roundup/mailer.py", line 153,
in exception_messa ge
self.standard_m essage(to, subject, content)
File "/usr/lib/python2.3/site-packages/roundup/mailer.py", line 93,
in standard_messag e
self.smtp_send( to, message)
File "/usr/lib/python2.3/site-packages/roundup/mailer.py", line 173,
in smtp_send
smtp = SMTPConnection( self.config)
File "/usr/lib/python2.3/site-packages/roundup/mailer.py", line 194,
in __init__
self.ehlo()
File "/usr/lib/python2.3/smtplib.py", line 390, in ehlo
(code,msg)=self .getreply()
File "/usr/lib/python2.3/smtplib.py", line 344, in getreply
line = self.file.readl ine()
File "/usr/lib/python2.3/smtplib.py", line 159, in readline
chr = self.sslobj.rea d(1)
sslerror: The read operation timed out

On 6/1/07, Tijs <ti*******@blue scraper.nlwrote :
carlistixx wrote:
[foobar@moe tracker]$ roundup-server -p 8081
roundup=/home/foobar/roundup/tracker
Roundup server started on :8081
send: 'STARTTLS\r\n'
reply: '503 5.5.2 Send hello first\r\n'
reply: retcode (503); Msg: 5.5.2 Send hello first

I think this must be an issue with roundup, issuing commands in the wrong
order. The correct order should (according to the rfc and the python docs)
be:
* ehlo()
* starttls()
* ehlo()
* login()
...

--

Regards,
Tijs
--
http://mail.python.org/mailman/listinfo/python-list
Jun 4 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2314
by: stewart.midwinter | last post by:
I'm having problem with a script that used to work under Win2k but is now broken after an install of WinXP Pro. I can no longer connect to a local mail server. Has anyone else seen this? If so, were you able to work around it? Here's the traceback (below). Interestingly, if I change ports to the POP port 110, I get a different error, but one that lets me know that I can reach the server. trying to connect on the SMTP port 25: >>>...
8
2582
by: dccarson | last post by:
Here is a snippet of code which does not send to all recipients. However, it also does not inform me of this error. My suspicion is that this only fails for users with longer usernames. The two I seem to regularly fail on have 9 and 11 characters respectively. Most users have names <= 8 characters. domain = "myDomainHere.com" admin = "d123456@%s" % domain adminFull = "Full Name Here <%s>" % admin def mailMsg(text, subject, sender,...
3
4385
by: Van_Gogh | last post by:
Hi, I am learning how to use the smtplib module, but am having some very early problems, maybe because I don't understand it. So, am I correct that by following the example in the Python: >>> import smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org', """To: jcaesar@example.org
0
1206
by: Richard Jones | last post by:
I'm proud to release this, the 1.1.1 release of Roundup. Fixed in this release: - failure with browsers not sending "Accept-Language" header (sf bugs 1429646 and 1435335) - translate class name in "required property not supplied" error message (sf bug 1429669) - error in link property lookups with numeric-alike key values (sf bug 1424550)
5
2472
by: tobiah | last post by:
In the example at: http://docs.python.org/lib/SMTP-example.html The text of the email message ends up with the From: and To: headers in it, and yet the call to sendmail() on the server object requires me to specify them again. Shouldn't smptlib just make the headers for me, given the 'from' and 'to' addresses? Perhaps this allows
158
6360
by: Giovanni Bajo | last post by:
Hello, I just read this mail by Brett Cannon: http://mail.python.org/pipermail/python-dev/2006-October/069139.html where the "PSF infrastracture committee", after weeks of evaluation, recommends using a non open source tracker (called JIRA - never heard before of course) for Python itself. Does this smell "Bitkeeper fiasco" to anyone else than me? --
4
1578
by: Richard Jones | last post by:
I'm proud to release version 1.1.3 of Roundup. Feature: - supports Python 2.5, including the sqlite3 module - full timezone support (sf patch 1465296) - handle connection loss when responding to web requests - match incoming mail In-Reply-To against existing messages when no issue id is specified in the Subject - added StringHTMLProperty wrapped() method to wrap long lines in issue display
0
1294
by: Richard Jones | last post by:
I'm proud to release version 1.3.3 of Roundup. Fixed in 1.3.3: - If-Modified-Since handling was broken - Updated documentation for customising hard-coded searches in page.html - Updated Windows installation docs (thanks Bo Berglund) - Handle rounding of seconds generating invalid date values - Handle 8-bit untranslateable messages from database properties - Fix scripts/roundup-reminder date calculation (sf bug 1649979)
1
5693
by: Benedict Verheyen | last post by:
Hi, i get an "Unable to relay for" when trying to send an email from within my network to an email address not on my domain. I don't understand why it says "relaying" as i'm sending from an internal domain user to an external user. Email server is exchange 2003 See this trace
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.