[New-bugs-announce] [issue16005] smtplib.SMTP().sendmail() and rset()
report at bugs.python.org
Sun Sep 23 14:21:25 CEST 2012
New submission from DDarko:
I'm trying to send an email as follows:
smtp = smtplib.SMTP(host, port=25)
smtp.sendmail(from_mail, to_mail, data)
The last line / command calls the raise.
I would like to know the reason why SMTP did not accept my email?
In theory, enough to capture the exception.
However, the exception of the last line returns:
"smtplib.SMTPServerDisconnected: Connection unexpectedly closed"
This is because the smtplib get replies in:
767 (code, resp) = self.data(msg)
As a result, the SMTP server disconnects the client. And instead receive info with reason I have information about sudden disconnection.
I do not think it should be reset, and if it is wrapped in a try.
(code, resp) = self.data(msg)
if code != 250:
raise SMTPDataError(code, resp)
#if we got here then somebody got our mail
This happens on servers mx.google.com
components: Library (Lib)
title: smtplib.SMTP().sendmail() and rset()
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce