Commit Graph

94 Commits

Author SHA1 Message Date
Antoine Pitrou 21ce8f0d66 Issue #11927: SMTP_SSL now uses port 465 by default as documented. Patch by Kasun Herath. 2011-05-07 19:59:33 +02:00
Giampaolo Rodolà 5c12ec6fee smtlib.py PEP8 normalization via pep8.py script. 2011-02-24 20:43:11 +00:00
R. David Murray ad3058e0b8 Fix Issue #4066: smtplib.SMTP_SSL._get_socket now correctly returns
the socket.  Patch by Farhan Ahmad, test by Marcin Bachry.
2009-05-23 00:48:58 +00:00
Kristján Valur Jónsson 51a035e383 Issue 4929: Handle socket errors when receiving 2009-01-15 17:20:21 +00:00
Facundo Batista 4f1b1ed975 Fixed the semantic of timeout for socket.create_connection and
all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
2008-05-29 16:39:26 +00:00
Georg Brandl deaf2cafbd #2248: return result of QUIT from quit(). 2008-03-27 13:27:31 +00:00
Sean Reifscheider ac2ed1e0ac Issue #2143: Fix embedded readline() hang on SSL socket EOF. 2008-03-20 00:46:50 +00:00
Facundo Batista 1660933d23 Issue 1776581. Minor corrections to smtplib, and two small tests.
Thanks Alan McIntyre.
2008-02-23 12:27:17 +00:00
Gregory P. Smith bde4ae4bde Fixes (accepts patch) issue1339 - http://bugs.python.org/issue1339
- Factor out the duplication of EHLO/HELO in login() and sendmail() to
  a new function, ehlo_or_helo_if_needed().
- Use ehlo_or_helo_if_needed() in starttls()
- Check for the starttls exception in starttls() in the same way as
  login() checks for the auth extension.
Contributed by Bill Fenner.
2008-01-17 08:35:49 +00:00
Gregory P. Smith 63bfc1d19f Comply with RFC 3207.
Fixes issue 829951 - http://bugs.python.org/issue829951
2008-01-17 07:43:20 +00:00
Bill Janssen 98d19dafd9 More work on SSL support.
* Much expanded test suite:

  All protocols tested against all other protocols.
  All protocols tested with all certificate options.
  Tests for bad key and bad cert.
  Test of STARTTLS functionality.
  Test of RAND_* functions.

* Fixes for threading/malloc bug.

* Issue 1065 fixed:

  sslsocket class renamed to SSLSocket.
  sslerror class renamed to SSLError.
  Function "wrap_socket" now used to wrap an existing socket.

* Issue 1583946 finally fixed:

  Support for subjectAltName added.
  Subject name now returned as proper DN list of RDNs.

* SSLError exported from socket as "sslerror".

* RAND_* functions properly exported from ssl.py.

* Documentation improved:

  Example of how to create a self-signed certificate.
  Better indexing.
2007-09-10 21:51:02 +00:00
Bill Janssen 470dcd2611 remove use of non-existent SSLFakeSocket in apparently untested code 2007-08-31 19:03:31 +00:00
Thomas Wouters a6900e8d72 Don't lie in __all__ attributes when SSL is not available: only add the SSL
classes when they are actually created.
2007-08-30 21:54:39 +00:00
Bill Janssen 426ea0a864 This contains a number of things:
1) Improve the documentation of the SSL module, with a fuller
   explanation of certificate usage, another reference, proper
   formatting of this and that.

2) Fix Windows bug in ssl.py, and general bug in sslsocket.close().
   Remove some unused code from ssl.py.  Allow accept() to be called on
   sslsocket sockets.

3) Use try-except-else in import of ssl in socket.py.  Deprecate use of
   socket.ssl().

4) Remove use of socket.ssl() in every library module, except for
   test_socket_ssl.py and test_ssl.py.
2007-08-29 22:35:05 +00:00
Facundo Batista 366d6262f8 Added timeout to smtplib (to SMTP and SMTP_SSL). Also created
the test_smtplib.py file, with a basic test and the timeout
ones. Docs are updated too.
2007-03-28 18:25:54 +00:00
Tim Peters ea5962f86e Whitespace normalization. 2007-03-12 18:07:52 +00:00
Neal Norwitz c8f6c23b0b Simplify a little by handling the TCP case first.
Update to use predominant style of spaces around = in args list
and print to stderr if debugging.
2007-03-10 03:19:18 +00:00
Martin v. Löwis 1190a38d33 Patch #957003: Implement smtplib.LMTP. 2007-03-09 15:35:55 +00:00
Georg Brandl 5a096e1b10 Use new email module names (#1637162, #1637159, #1637157). 2007-01-22 19:40:21 +00:00
Tim Peters abd8a336a3 Whitespace normalization. 2006-11-03 02:32:46 +00:00
Martin v. Löwis ee82c0e6b7 Patch #1567274: Support SMTP over TLS. 2006-10-27 07:13:28 +00:00
Martin Blais 215f13dd11 Normalized a few cases of whitespace in function declarations.
Found them using::

  find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done
  find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done

(I was doing this all over my own code anyway, because I'd been using spaces in
all defs, so I thought I'd make a run on the Python code as well.  If you need
to do such fixes in your own code, you can use xx-rename or parenregu.el within
emacs.)
2006-06-06 12:46:55 +00:00
Georg Brandl dcdfd22bb4 bug #1257988: don't bail out on gethostbyname(gethostname()) failure 2006-03-31 19:34:13 +00:00
Georg Brandl bd3bc4dc4c Bug #1430298: It is now possible to send a mail with an empty
return address using smtplib.
2006-02-17 09:52:53 +00:00
Kurt B. Kaiser 58bd19095a SMTP.help() was returning a tuple instead of the promised text. 2005-06-26 18:27:36 +00:00
Raymond Hettinger dbecd93b72 Replace list of constants with tuples of constants. 2005-02-06 06:57:08 +00:00
Johannes Gijsbers 5954623bc0 Patch #1100140: improved smtp connect debugging
Don't print the same (host, port) tuple thrice when debugging, but first print
(host, port), then (ip, port) and then the error message.
2005-01-16 13:04:30 +00:00
Johannes Gijsbers 9a98364ba3 Replace rfc822.parseaddr with email.Utils.parseaddr. The implementation is
still the same, so there should be no backwards-compatibility problems.
2005-01-08 14:12:27 +00:00
Johannes Gijsbers 25946ddac9 Patch #1075928: AUTH PLAIN in smtplib.
smtplib can not log in to some server using command AUTH PLAIN, it sends
``user\0user\0pass'' to the server, but ``\0user\0pass'' has better
compatibility.
2004-12-06 21:25:26 +00:00
Brett Cannon e6f8a89d1a Debug output is now printed to sys.stderr .
Closes bug #980938.
2004-07-10 23:14:30 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Martin v. Löwis 49c05d39e3 Patch #572031: AUTH method LOGIN for smtplib
(most of the patch hides in rev. 1.59). Backported to 2.2.
2002-10-06 17:55:08 +00:00
Raymond Hettinger 342456d5d2 smptlib did not handle empty addresses.
The problem was that it expected rfc822.parseaddr() to return None
upon a parse failure.  The actual, documented return value for a
parse failure is (None, None).

Closes SF bug 602029.
2002-09-05 01:14:07 +00:00
Tim Peters 469cdad822 Whitespace normalization. 2002-08-08 20:19:19 +00:00
Martin v. Löwis 301b1cd107 Patch #586999: Fix multiline string in sendmail example. 2002-07-28 16:52:01 +00:00
Piers Lauder 385a77acad remove o/s dependancy from test 2002-07-27 00:38:30 +00:00
Walter Dörwald 65230a2de7 Remove uses of the string and types modules:
x in string.whitespace => x.isspace()
type(x) in types.StringTypes => isinstance(x, basestring)
isinstance(x, types.StringTypes) => isinstance(x, basestring)
type(x) is types.StringType => isinstance(x, str)
type(x) == types.StringType => isinstance(x, str)
string.split(x, ...) => x.split(...)
string.join(x, y) => y.join(x)
string.zfill(x, ...) => x.zfill(...)
string.count(x, ...) => x.count(...)
hasattr(types, "UnicodeType") => try: unicode except NameError:
type(x) != types.TupleTuple => not isinstance(x, tuple)
isinstance(x, types.TupleType) => isinstance(x, tuple)
type(x) is types.IntType => isinstance(x, int)

Do not mention the string module in the rlcompleter docstring.

This partially applies SF patch http://www.python.org/sf/562373
(with basestring instead of string). (It excludes the changes to
unittest.py and does not change the os.stat stuff.)
2002-06-03 15:58:32 +00:00
Martin v. Löwis 9ea6c19747 Patch #552060: Add SSLFakeSocket.sendall. Also committed for 2.2 maint. 2002-06-02 12:33:22 +00:00
Raymond Hettinger f13eb55d59 Replace boolean test with is None. 2002-06-02 00:40:05 +00:00
Raymond Hettinger 54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Raymond Hettinger 7fdfc2d231 Replace '== None' with 'is None' 2002-05-31 17:49:10 +00:00
Tim Peters 863ac44b74 Whitespace normalization. 2002-04-16 01:38:40 +00:00
Barry Warsaw be22ae6def ehlo(): A proper fix for SF bug #498572. RFC 1869 describes ESMTP
which requires that if there are ehlo parameters returned with an ehlo
keyword (in the response to EHLO), the keyword and parameters must be
delimited by an ASCII space.  Thus responses like

    250-AUTH=LOGIN

should be ignored as non-conformant to the RFC (the `=' isn't allowed
in the ehlo keyword).

This is a bug fix candidate.
2002-04-15 20:03:30 +00:00
Barry Warsaw 13e34f7a19 __init__(): We'll try to be more RFC 2821 compliant by providing for a
better local_hostname default.  According to RFC 2821, it is
recommended that the fqdn hostname be provided in the EHLO/HELO verb
and if that can't be calculated, to use a domain literal.

The rationale for this change is documented in SF patch #497736 which
also had privacy concerns about leaking the fqdn in the EHLO/HELO.  We
decided this wasn't a big concern because no user data is leaked, and
the IP will always be leaked.  The local_hostname argument is provided
for those clients that are super paranoid.

Using localhost.localdomain may break some strict smtp servers so we
decided against using it as the default.
2002-03-26 20:27:35 +00:00
Barry Warsaw 4b186aff48 SMTP.__init__(): Fixed minor typo in docstring. 2002-03-25 04:00:38 +00:00
Neil Schemenauer 6730f26cb0 Add local_hostname option to SMTP.__init__. If supplied, it is used
as the fully qualified local hostname.
2002-03-24 15:30:40 +00:00
Martin v. Löwis 3356766abf Accept Unicode strings as SMTP TO addresses. Fixes #521270.
2.2.1 candidate.
2002-02-24 15:07:24 +00:00
Martin v. Löwis e12454f44a The Grande 'sendall()' patch, copied from release21-maint. Fixes #516715.
Replaces calls to socket.send() (which isn't guaranteed to send all data)
with the new socket.sendall() method.
2002-02-16 23:06:19 +00:00
Barry Warsaw 7675097d78 send(), ehlo(): Integrate patch #487310 by Fazal Majid. Consistently
call self.close() just before raising SMTPServerDisconnected.  This
allows you to, e.g. reconnect after a server timeout.

Merged from the 2.2c1 branch.
2001-12-14 20:34:20 +00:00
Fred Drake 2f8f4d3678 SMTPError should be SMTPException; reported by Neal Norwitz. 2001-10-13 18:35:32 +00:00