Commit Graph

151 Commits

Author SHA1 Message Date
R David Murray 0cff49fcf9 #22215: have the smtplib 'quit' command reset the state.
Without this reset, starttls would fail if a connect/starttls was done after a
quit, because smtplib assumed the existing value of emspt_features was
accurate, but it gets reset when starttls completes (and the new value does
not contain the starttls capability, since tls is already started at that
point).  (There may be additional places where this lack of reset was an
issue as well.)

Patch by Milan Oberkirch.
2014-08-30 16:51:59 -04:00
Senthil Kumaran 4ce118e99a Fix issue #21641: Close the socket before raising the SMTPResponseException. Fixes the ResourceWarning in the test run.
Patch by Claudiu.Popa.
2014-06-03 07:24:54 -07:00
R David Murray afb151a5cc #17498: Defer SMTPServerDisconnected errors until the next command.
Normally an SMTP server will return an error, and smtplib will then issue an
RSET to return the connection to the known starting state.  Some servers,
however, disconnect after issuing certain errors.  When we issue the RSET,
this would result in raising an SMTPServerDisconnected error, *instead* of
returning the error code the user of the library was expecting.  This fix
makes the internal RSET calls ignore the disconnection so that the error code
is returned.  The user of the library will then get the SMTPServerDisconnected
error the next time they try to talk to the server.

Patch by Kushal Das.
2014-04-14 18:21:38 -04:00
Georg Brandl b38b5c43c7 merge with 3.3 2014-02-10 22:11:21 +01:00
Serhiy Storchaka 8f8ec92de8 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang lines in the unittestgui and checkpip scripts.
2014-01-16 17:33:23 +02:00
Serhiy Storchaka b992a0e102 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang line to use python3 executable in the unittestgui script.
2014-01-16 17:15:49 +02:00
Christian Heimes a5768f7292 Issue #19785: smtplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.
2013-12-02 20:44:17 +01:00
Christian Heimes 67986f9431 Issue #19735: Implement private function ssl._create_stdlib_context() to
create SSLContext objects in Python's stdlib module. It provides a single
configuration point and makes use of SSLContext.load_default_certs().
2013-11-23 22:43:47 +01:00
Christian Heimes 634919a9fa Issue #17276: MD5 as default digestmod for HMAC is deprecated. The HMAC
module supports digestmod names, e.g. hmac.HMAC('sha1').
2013-11-20 17:23:06 +01:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
R David Murray 9dac840e3c Merge #18179: reflow paragraphs. 2013-06-23 16:06:13 -04:00
R David Murray 021362dbd4 #18179: reflow paragraphs. 2013-06-23 16:05:44 -04:00
R David Murray ec94eac4c9 Merge #18179: document the local_hostname parameter.
Original patch by Berker Peksag.
2013-06-23 15:52:08 -04:00
R David Murray 36beb66be9 #18179: document the local_hostname parameter.
Original patch by Berker Peksag.
2013-06-23 15:47:50 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
R David Murray 8a34596bbe #2118: IOError is deprecated, use OSError. 2013-04-14 06:46:35 -04:00
R David Murray 8e37d5df95 #2118: Make SMTPException a subclass of IOError.
Initial patch by Ned Jackson Lovely.
2013-04-13 14:49:48 -04:00
R David Murray c1d3daf58b Merge #2118: clarify smtplib exception documentation. 2013-04-13 14:42:36 -04:00
R David Murray 14ee3cf244 #2118: clarify smtplib exception documentation. 2013-04-13 14:40:33 -04:00
R David Murray 82c6b45c14 Merge: #5713: Handle 421 error codes during sendmail by closing the socket.
This is a partial fix to the issue of servers disconnecting unexpectedly; in
this case the 421 says they are disconnecting, so we close the socket and
return the 421 in the appropriate error context.

Original patch by Mark Sapiro, updated by Kushal Das, with additional
tests by me.
2013-03-20 21:13:56 -04:00
R David Murray f1a40b4ec5 Merge: #5713: Handle 421 error codes during sendmail by closing the socket.
This is a partial fix to the issue of servers disconnecting unexpectedly; in
this case the 421 says they are disconnecting, so we close the socket and
return the 421 in the appropriate error context.

Original patch by Mark Sapiro, updated by Kushal Das, with additional
tests by me.
2013-03-20 21:12:17 -04:00
R David Murray d312c740f1 #5713: Handle 421 error codes during sendmail by closing the socket.
This is a partial fix to the issue of servers disconnecting unexpectedly; in
this case the 421 says they are disconnecting, so we close the socket and
return the 421 in the appropriate error context.

Original patch by Mark Sapiro, updated by Kushal Das, with additional
tests by me.
2013-03-20 20:36:14 -04:00
Andrew Svetlov 2ade6f24cb Issue #16647: save socket error details in LMTP.connect()
Initial patch by Serhiy Storchaka.
2012-12-17 18:57:16 +02:00
Andrew Svetlov 3b69824de9 Issue #16647: save socket error details in LMTP.connect()
Patch by Serhiy Storchaka.
2012-12-17 18:55:10 +02:00
Andrew Svetlov b6693c4604 Issue #16647: save socket error details in LMTP.connect()
Patch by Serhiy Storchaka.
2012-12-17 18:54:53 +02:00
Ezio Melotti 3de134b1d1 #12448: merge with 3.2. 2011-10-18 13:26:49 +03:00
Ezio Melotti 6bfecd1271 #12448: smtplib now flushes stdout while running ``python -m smtplib``
in order to display the prompt correctly.  Patch by Petri Lehtinen.
2011-10-18 13:20:07 +03:00
Antoine Pitrou a5dba1abea Provide a better diagnosis on socket errors 2011-08-28 01:22:22 +02:00
Antoine Pitrou 6b2e160d27 Provide a better diagnosis on socket errors 2011-08-28 01:20:42 +02:00
Senthil Kumaran b351a48eee Addressing the review comments by Antoine Pitrou for smtplib.py and test_smtplib.py. Review comments by Ezio Melotti for smtplib.rst 2011-07-31 09:14:17 +08:00
Senthil Kumaran 3d23fd6493 Fix closes Issue11281 - smtplib.STMP gets source_address parameter, which adds the ability to bind to specific source address on a machine with multiple interfaces. Patch by Paulo Scardine. 2011-07-30 10:56:50 +08:00
R David Murray 4c14bba7f9 #7484: simplify quoteaddr: if parseaddr throws an error it is a bug.
As far as I can tell, the try/except was ancient code, from before the email
package rewrite where the philosophy of never throwing parsing errors was
adopted.
2011-07-18 21:59:53 -04:00
R David Murray da7af4d7a1 Merge #7484: no more <> around addresses in VRFY or EXPN 2011-07-18 21:42:28 -04:00
R David Murray 4634676cec #7484: no more <> around addresses in VRFY or EXPN
The RFC doesn't say that they are allowed; apparently many mailers accept
them, but not postfix.  Contributions to this patch were made by Felipe Cruz
and Catalin Iacob.

The changeset also adds additional indirect tests for quoteaddr (null address
and IDNA-encoded address).
2011-07-18 21:38:54 -04:00
R David Murray db4120bf9d merge #12147: make send_message correctly handle Sender and Resent- headers. 2011-07-02 21:10:44 -04:00
R David Murray ac4e5abc78 #12147: make send_message correctly handle Sender and Resent- headers.
Original patch by Nicolas Estibals.  My tweaks to the patch were mostly
style/cosmetic, and adding more tests.
2011-07-02 21:03:19 -04:00
R David Murray 0a9f16b627 merge #12283: Fixed regression in smtplib quoting of leading dots in DATA. 2011-06-09 15:21:02 -04:00
R David Murray 0f663d07e6 #12283: Fixed regression in smtplib quoting of leading dots in DATA.
I unfortunately introduced the regression when I refactored the code,
and there were no tests of quoting so it wasn't caught.  Now there
is one.
2011-06-09 15:05:57 -04:00
Antoine Pitrou f068ab8304 Issue #11893: Remove obsolete internal wrapper class `SSLFakeFile` in the smtplib module.
Patch by Catalin Iacob.
2011-06-06 19:17:09 +02:00
Antoine Pitrou e065020680 Issue #8809: The SMTP_SSL constructor and SMTP.starttls() now support
passing a `context` argument pointing to an ssl.SSLContext instance.
Patch by Kasun Herath.
2011-05-18 18:03:09 +02:00
Antoine Pitrou d7f12f30e4 Merge: Issue #11927: SMTP_SSL now uses port 465 by default as documented. 2011-05-07 19:42:39 +02:00
Antoine Pitrou 5bcc50c1b5 Merge: Issue #11927: SMTP_SSL now uses port 465 by default as documented. 2011-05-07 19:41:33 +02:00
Antoine Pitrou c1d520634a Issue #11927: SMTP_SSL now uses port 465 by default as documented. Patch by Kasun Herath. 2011-05-07 19:39:37 +02:00
Barry Warsaw 1f5c958721 - Issue #11289: `smtp.SMTP` class becomes a context manager so it can be used
in a `with` statement.  Contributed by Giampaolo Rodola.
2011-03-15 15:04:44 -04:00
Giampaolo Rodolà f4977d2f50 Merged revisions 88501 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88501 | giampaolo.rodola | 2011-02-22 16:56:20 +0100 (mar, 22 feb 2011) | 1 line

  smtlib.py PEP8 normalization via pep8.py script.
........
2011-02-24 20:25:11 +00:00
Giampaolo Rodolà bd258bd4c6 smtlib.py PEP8 normalization via pep8.py script. 2011-02-22 15:56:20 +00:00
R. David Murray 7dff9e08fb #10321: Add support for sending binary DATA and Message objects to smtplib 2010-11-08 17:15:13 +00:00
Gerhard Häring 1c5471f319 Issue #6683: For SMTP logins we now try all authentication methods advertised
by the server. Many servers are buggy and advertise authentication methods they
o not support in reality. This change makes smtplib.auth() work more often in
the real world, where we face misconfigured servers and servers that advertise
methods they don't support due to the madness that is SASL.
2010-08-05 14:08:44 +00:00
Benjamin Peterson 90f5ba538b convert shebang lines: python -> python3 2010-03-11 22:53:45 +00:00
Ezio Melotti 6e52a5a837 Merged revisions 75064 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r75064 | ezio.melotti | 2009-09-26 00:35:24 +0300 (Sat, 26 Sep 2009) | 1 line

  fix print statement
........
2009-09-25 21:38:29 +00:00