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.
This commit is contained in:
Guido van Rossum 2001-09-14 16:08:44 +00:00
parent 5f5512d246
commit f7fcf5eea6
2 changed files with 62 additions and 2 deletions

View file

@ -178,6 +178,14 @@ or may raise the following exceptions:
\end{description}
\end{methoddesc}
\begin{methoddesc}{starttls}{\optional{keyfile, certfile}}
Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP
commands that follow will be encrypted. You should then call ehlo() again.
If \var{keyfile} and \var{certfile} are provided, these are passed to the
socket module's ssl function.
\end{methoddesc}
\begin{methoddesc}{sendmail}{from_addr, to_addrs, msg\optional{,
mail_options, rcpt_options}}
Send mail. The required arguments are an \rfc{822} from-address