Commit Graph

74 Commits

Author SHA1 Message Date
Gregory P. Smith 0f99b71bd0 ** backport r60015 from trunk.
- Issue829951: In the smtplib module, SMTP.starttls() now complies with
  RFC 3207 and forgets any knowledge obtained from the server not obtained
  from the TLS negotiation itself.  Patch contributed by Bill Fenner.
2008-01-17 07:54:47 +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
Martin v. Löwis 322c0d187d Only close sockets if they have been created. Reported by Blake Winton. 2001-10-07 08:53:32 +00:00
Tim Peters b64bec3ec0 Whitespace normalization. 2001-09-18 02:26:39 +00:00
Guido van Rossum f7fcf5eea6 SF patch #461413 (Gerhard Häring): Add STARTTLS feature to smtplib
This patch adds the features from RFC 2487 (Secure SMTP
   over TLS) to the smtplib module:

   - A starttls() function
   - Wrapper classes that simulate enough of sockets and
     files for smtplib, but really wrap a SSLObject
   - reset the list of known SMTP extensions at each call
     of ehlo(). This should have been the case anyway.
2001-09-14 16:08:44 +00:00
Guido van Rossum ae01046f7b Add login() method and SMTPAuthenticationError exception. SF patch
#460112 by Gerhard Haering.

(With slight layout changes to conform to docstrings guidelines and to
prevent a line longer than 78 characters.  Also fixed some docstrings
that Gerhard didn't touch.)
2001-09-11 15:57:46 +00:00
Andrew M. Kuchling 6be424fdd6 Remove redundant import 2001-08-13 14:41:39 +00:00
Martin v. Löwis 2ad2569c72 Initialize msg to avoid unbound locals. 2001-07-31 08:40:21 +00:00
Martin v. Löwis 4eb5940a4d Untabify IPv6 changes. 2001-07-26 13:37:33 +00:00
Martin v. Löwis a43c2f845e Patch #401196: Use getaddrinfo and AF_INET6 in TCP servers and clients. 2001-07-24 20:34:08 +00:00
Skip Montanaro 0de65807e6 bunch more __all__ lists
also modified check_all function to suppress all warnings since they aren't
relevant to what this test is doing (allows quiet checking of regsub, for
instance)
2001-02-15 22:15:14 +00:00
Eric S. Raymond 8d87603e3e Aha. We can remove he string import after all by using ValueError. 2001-02-09 10:14:53 +00:00
Eric S. Raymond 38151ed6b8 Fixed a bug in the test jig. 2001-02-09 07:40:17 +00:00
Eric S. Raymond c013f30060 String method conversion. 2001-02-09 05:40:38 +00:00
Tim Peters 495ad3c8cc Whitespace normalization. 2001-01-15 01:36:40 +00:00
Fred Drake 8152d32375 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:20:45 +00:00
Barry Warsaw 17bfef5860 SMTP.connect(): If the socket.connect() raises a socket.error, be sure
to call self.close() to reclaim some file descriptors, the reraise the
exception.  Closes SF patch #102185 and SF bug #119833.
2000-11-08 22:19:47 +00:00
Barry Warsaw 5bf94a0b77 Applied patch #101350, closing it. 2000-09-01 06:40:07 +00:00
Fred Drake 0ebc1c6952 Use socket.getfqdn() instead of defining make_fqdn(). 2000-08-16 14:26:22 +00:00
Thomas Wouters caa658d047 Apply SF patch #101151, by Peter S-K, which fixes smtplib's passing of the
'helo' and 'ehlo' message, and exports the 'make_fqdn' function. This
function should be moved to socket.py, if that module ever gets a Python
wrapper.
2000-08-15 19:30:36 +00:00
Peter Schneider-Kamp 7bc82bb1f0 add better algorithm to get fully qualified domain name for localhost
in smtplib.ehlo() and smtplib.helo().

closes patch #101103
closes bug   #110935
2000-08-10 14:02:23 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00