Commit Graph

179 Commits

Author SHA1 Message Date
Zackery Spytz 46a7564578 bpo-32793: Fix a duplicate debug message in smtplib (GH-15341)
_get_socket() already prints a debug message for the host and port.



https://bugs.python.org/issue32793



Automerge-Triggered-By: @maxking
2019-08-20 10:52:25 -07:00
Steve Dower 44f91c388a
bpo-37390: Add audit event table to documentations (GH-14406)
Also updates some (unreleased) event names to be consistent with the others.
2019-06-27 10:47:59 -07:00
Steve Dower 60419a7e96
bpo-37363: Add audit events for a range of modules (GH-14301) 2019-06-24 08:42:54 -07:00
Pablo Aguiar 4b5e62dbb2 bpo-35128: Fix spacing issues in warning.warn() messages. (GH-10268) 2018-11-01 12:33:35 +02:00
Romuald Brunet 7b31397180 bpo-32680 add default "sock" on SMTP objects (#5345)
By default the smtplib.SMTP objects did not have a sock attribute, it
was only created during connect()
2018-10-09 16:31:55 +02:00
Sebastian Rittau 78deb7f332 closes bpo-34525: Fix smtplib's authobject() documentation (GH-8965) 2018-09-10 10:29:43 -07:00
Pablo Aguiar d5fbe9b1a3 bpo-34246: Use no mutable default args in smtplib (GH-8554)
Some methods of the SMTP class use mutable default arguments. Specially
`send_message` is affected as it mutates one of the args by appending items
to it, which has side effects on further calls.
2018-09-07 23:04:48 +01:00
Stéphane Wirtel 8d83e4ba78 bpo-32727: smtplib's SMTP.send_message behaves differently with from_addr and to_addrs (#5451)
Do not pass the name field in the 'from' address in the SMTP envelope.
2018-01-30 19:02:51 -05:00
Joel Hillacre 9e98cd0383 bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) 2017-05-24 13:14:50 +08:00
Christian Heimes d04863771b Issue #28022: Deprecate ssl-related arguments in favor of SSLContext.
The deprecation include manual creation of SSLSocket and certfile/keyfile
(or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib.

ssl.wrap_socket() is not marked as deprecated yet.
2016-09-10 23:23:33 +02:00
Berker Peksag e39682b076 Issue #27430: Fix typos, patch by scop. 2016-07-01 12:17:05 +03:00
Benjamin Peterson b0557e729e merge 3.4 2016-06-11 13:18:56 -07:00
Benjamin Peterson 46b32f307c raise an error when STARTTLS fails 2016-06-11 13:16:42 -07:00
Serhiy Storchaka 7e7a3dba5f Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:24:41 +03:00
Serhiy Storchaka 9f8a8910a4 Escaped backslashes in docstrings. 2015-04-03 18:12:41 +03:00
Benjamin Peterson 7243b574e5 don't require OpenSSL SNI to pass hostname to ssl functions (#22921)
Patch by Donald Stufft.
2014-11-23 17:04:34 -06:00
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
R David Murray b0deeb47d8 #25446: Fix regression in smtplib's AUTH LOGIN support.
The auth method tests simply weren't adequate because of the fact that
smtpd doesn't support authentication.  I borrowed some of Milan's
code for that from issue #21935 and added it to the smtplib tests.
Also discovered that the direct test for the 'auth' method wasn't actually
testing anything and fixed it.

The fix makes the new authobject mechanism work the way it is
documented...the problem was that wasn't checking for a 334 return code
if an initial-response was provided, which works fine for auth plain
and cram-md5, but not for auth login.
2015-11-08 01:03:52 -05:00
Benjamin Peterson 669ff66c32 remove duplicated imports (closes #25502) 2015-10-28 23:15:13 -07:00
Barry Warsaw c5ea754e48 - Issue #15014: SMTP.auth() and SMTP.login() now support RFC 4954's optional
initial-response argument to the SMTP AUTH command.
2015-07-09 10:39:55 -04:00
R David Murray 8308444eef #24218: Add SMTPUTF8 support to send_message.
Reviewed by Maciej Szulik.
2015-05-17 19:27:22 -04:00
R David Murray cee7cf6026 #22027: Add RFC6531 support to smtplib.
Initial patch by Milan Oberkirch.
2015-05-16 13:58:14 -04:00
R David Murray 37f1ba915b #16914: fix test errors under -W error::BytesWarning.
There are doubtless other debug messages in smtplib that would trigger an
error if they were tested, but this fixes the things we do now test,
which is good enough for now.
2015-04-16 18:54:56 -04:00
R David Murray 0c49b896e6 #16914: add timestamps to smtplib debugging output via new debuglevel 2.
Patch by Gavin Chappell and Maciej Szulik.
2015-04-16 17:14:42 -04:00
Serhiy Storchaka 2116b12da5 Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:29:28 +03:00
Serhiy Storchaka 50ef0f41af Escaped backslashes in docstrings. 2015-04-03 18:13:23 +03:00