summaryrefslogtreecommitdiffstats
path: root/Lib/smtplib.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove uses of the string and types modules:Walter Dörwald2002-06-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | 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.)
* Patch #552060: Add SSLFakeSocket.sendall. Also committed for 2.2 maint.Martin v. Löwis2002-06-021-0/+2
|
* Replace boolean test with is None.Raymond Hettinger2002-06-021-1/+1
|
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-1/+1
|
* Replace '== None' with 'is None'Raymond Hettinger2002-05-311-1/+1
|
* Whitespace normalization.Tim Peters2002-04-161-2/+2
|
* ehlo(): A proper fix for SF bug #498572. RFC 1869 describes ESMTPBarry Warsaw2002-04-151-1/+5
| | | | | | | | | | | | | 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.
* __init__(): We'll try to be more RFC 2821 compliant by providing for aBarry Warsaw2002-03-261-2/+11
| | | | | | | | | | | | | | | 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.
* SMTP.__init__(): Fixed minor typo in docstring.Barry Warsaw2002-03-251-1/+1
|
* Add local_hostname option to SMTP.__init__. If supplied, it is usedNeil Schemenauer2002-03-241-10/+10
| | | | as the fully qualified local hostname.
* Accept Unicode strings as SMTP TO addresses. Fixes #521270.Martin v. Löwis2002-02-241-1/+1
| | | | 2.2.1 candidate.
* The Grande 'sendall()' patch, copied from release21-maint. Fixes #516715.Martin v. Löwis2002-02-161-3/+1
| | | | | Replaces calls to socket.send() (which isn't guaranteed to send all data) with the new socket.sendall() method.
* send(), ehlo(): Integrate patch #487310 by Fazal Majid. ConsistentlyBarry Warsaw2001-12-141-0/+2
| | | | | | | call self.close() just before raising SMTPServerDisconnected. This allows you to, e.g. reconnect after a server timeout. Merged from the 2.2c1 branch.
* SMTPError should be SMTPException; reported by Neal Norwitz.Fred Drake2001-10-131-2/+2
|
* Only close sockets if they have been created. Reported by Blake Winton.Martin v. Löwis2001-10-071-1/+3
|
* Whitespace normalization.Tim Peters2001-09-181-7/+7
|
* SF patch #461413 (Gerhard Häring): Add STARTTLS feature to smtplibGuido van Rossum2001-09-141-2/+54
| | | | | | | | | | | 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.
* Add login() method and SMTPAuthenticationError exception. SF patchGuido van Rossum2001-09-111-3/+93
| | | | | | | | #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.)
* Remove redundant importAndrew M. Kuchling2001-08-131-1/+1
|
* Initialize msg to avoid unbound locals.Martin v. Löwis2001-07-311-0/+1
|
* Untabify IPv6 changes.Martin v. Löwis2001-07-261-16/+16
|
* Patch #401196: Use getaddrinfo and AF_INET6 in TCP servers and clients.Martin v. Löwis2001-07-241-12/+20
|
* bunch more __all__ listsSkip Montanaro2001-02-151-0/+5
| | | | | | 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)
* Aha. We can remove he string import after all by using ValueError.Eric S. Raymond2001-02-091-2/+1
|
* Fixed a bug in the test jig.Eric S. Raymond2001-02-091-1/+1
|
* String method conversion.Eric S. Raymond2001-02-091-13/+13
|
* Whitespace normalization.Tim Peters2001-01-151-31/+31
|
* Update the code to better reflect recommended style:Fred Drake2000-12-121-6/+6
| | | | | Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
* SMTP.connect(): If the socket.connect() raises a socket.error, be sureBarry Warsaw2000-11-081-1/+5
| | | | | to call self.close() to reclaim some file descriptors, the reraise the exception. Closes SF patch #102185 and SF bug #119833.
* Applied patch #101350, closing it.Barry Warsaw2000-09-011-1/+3
|
* Use socket.getfqdn() instead of defining make_fqdn().Fred Drake2000-08-161-27/+2
|
* Apply SF patch #101151, by Peter S-K, which fixes smtplib's passing of theThomas Wouters2000-08-151-13/+27
| | | | | | '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.
* add better algorithm to get fully qualified domain name for localhostPeter Schneider-Kamp2000-08-101-17/+21
| | | | | | | in smtplib.ehlo() and smtplib.helo(). closes patch #101103 closes bug #110935
* Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters2000-07-161-2/+2
| | | | | | | | | | 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 ;)
* Use TQSQ (triple quoted single quote) module docstring for betterBarry Warsaw2000-07-091-2/+2
| | | | font-locking. This complets the merge with Mailman's version.
* Fredrik Lundh:Guido van Rossum2000-03-281-1/+1
| | | | | This fixes a bunch of socket.connect(host, post) calls. Note that I haven't tested all modules -- I don't have enough servers here...
* Simple changes by Gerrit Holl - move author acknowledgements out ofGuido van Rossum2000-02-281-8/+8
| | | | docstrings into comments.
* Actually, the previous batch's comment should have been different;Guido van Rossum2000-02-041-2/+2
| | | | | | | | | | *this* set of patches is Ka-Ping's final sweep: The attached patches update the standard library so that all modules have docstrings beginning with one-line summaries. A new docstring was added to formatter. The docstring for os.py was updated to mention nt, os2, ce in addition to posix, dos, mac.
* A bunch of docstring fixes.Barry Warsaw1999-11-281-23/+22
|
* In helo() and ehlo(), Don't fail when gethostbyaddr() fails -- justGuido van Rossum1999-10-221-2/+10
| | | | keep whatever gethostname() returns. After a suggestion by Doug Wyatt.
* Patch by Per Cederqvist:Guido van Rossum1999-06-091-3/+6
| | | | | | | I've found two places where smtplib.py sends an extra trailing space on command lines to the SMTP server. I don't know if this ever causes any problems, but I'd prefer to be on the safe side. The enclosed patch removes the extra space.
* Patch by Per Cederqvist, seemingly approved by The Dragon:Guido van Rossum1999-04-211-3/+6
| | | | | | | Two problems: The SMTPRecipientsRefused class should not inherit SMTPResponseException, since it doesn't provide the smtp_code and smtp_error attributes. My patch for not adding an extra CRLF was apparently forgotten. The enclosed patch fixes these two problems.
* Changes by Per Cederquist and The Dragon.Guido van Rossum1999-04-071-49/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per writes: """ The application where Signum Support uses smtplib needs to be able to report good error messages to the user when sending email fails. To help in diagnosing problems it is useful to be able to report the entire message sent by the server, not only the SMTP error code of the offending command. A lot of the functions in sendmail.py unfortunately discards the message, leaving only the code. The enclosed patch fixes that problem. The enclosed patch also introduces a base class for exceptions that include an SMTP error code and error message, and make the code and message available on separate attributes, so that surrounding code can deal with them in whatever way it sees fit. I've also added some documentation to the exception classes. The constructor will now raise an exception if it cannot connect to the SMTP server. The data() method will raise an SMTPDataError if it doesn't receive the expected 354 code in the middle of the exchange. According to section 5.2.10 of RFC 1123 a smtp client must accept "any text, including no text at all" after the error code. If the response of a HELO command contains no text self.helo_resp will be set to the empty string (""). The patch fixes the test in the sendmail() method so that helo_resp is tested against None; if it has the empty string as value the sendmail() method would invoke the helo() method again. The code no longer accepts a -1 reply from the ehlo() method in sendmail(). [Text about removing SMTPRecipientsRefused deleted --GvR] """ and also: """ smtplib.py appends an extra blank line to the outgoing mail if the `msg' argument to the sendmail method already contains a trailing newline. This patch should fix the problem. """ The Dragon writes: """ Mostly I just re-added the SMTPRecipientsRefused exception (the exeption object now has the appropriate info in it ) [Per had removed this in his patch --GvR] and tweaked the behavior of the sendmail method whence it throws the newly added SMTPHeloException (it was closing the connection, which it shouldn't. whatever catches the exception should do that. ) I pondered the change of the return values to tuples all around, and after some thinking I decided that regularizing the return values was too much of the Right Thing (tm) to not do. My one concern is that code expecting an integer & getting a tuple may fail silently. (i.e. if it's doing : x.somemethod() >= 400: expecting an integer, the expression will always be true if it gets a tuple instead. ) However, most smtplib code I've seen only really uses the sendmail() method, so this wouldn't bother it. Usually code I've seen that calls the other methods usually only calls helo() and ehlo() for doing ESMTP, a feature which was not in the smtplib included with 1.5.1, and thus I would think not much code uses it yet. """
* Patch by Per Cederqvist, who writes:Guido van Rossum1999-03-291-6/+15
| | | | | | | | | | | | | | | | """ - It needlessly used the makefile() method for each response that is read from the SMTP server. - If the remote SMTP server closes the connection unexpectedly the code raised an IndexError. It now raises an SMTPServerDisconnected exception instead. - The code now checks that all lines in a multiline response actually contains an error code. """ The Dragon approves.
* Patch by Piers Lauder: make exceptions classes.Guido van Rossum1999-01-151-14/+13
| | | | Take opportunity to add more explanatory messages to exceptions.
* In rcpt(), avoid a space after the TO: address when the option list isGuido van Rossum1999-01-141-2/+2
| | | | empty. Make sure there is a space when there are options.
* Small, and final docstring merge with Dragon's version.Barry Warsaw1998-12-221-1/+5
|
* A few other docstring fixes, most importantly to be a little nicer toBarry Warsaw1998-12-221-54/+59
| | | | Emacs ;-)
* Nothing earthshattering, just some fixes to typos and other formattingBarry Warsaw1998-12-221-50/+53
| | | | bugs in various docstrings.
* Change interface to sendmail: if the destination address is a stringJeremy Hylton1998-08-131-1/+6
| | | | | | | instead of a list, turn it into a list containing that string. This avoids an apparently common newbie mistake -- passing in a single string for the destination and have it treated as a sequence of characters.