diff options
author | Tails developers <amnesia@boum.org> | 2012-09-16 22:15:16 +0200 |
---|---|---|
committer | Tails developers <amnesia@boum.org> | 2012-09-17 12:28:13 +0200 |
commit | 610dec83fc9d6844813fd66e9513e4e269bda2d1 (patch) | |
tree | 9433bee42df40dd4bab3f67754da5adc9fad94d8 | |
parent | 1ec71b0916fbbbe51682b47d2ec3a70dfdb95a13 (diff) |
Use smtplib's timeout parameter
It was introduced in Python 2.6 which is in debian squeeze
-rw-r--r-- | whisperBack/mail.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/whisperBack/mail.py b/whisperBack/mail.py index 856a6ef..4edc24a 100644 --- a/whisperBack/mail.py +++ b/whisperBack/mail.py @@ -65,14 +65,10 @@ def send_message_tls (from_address, to_address, message, host="localhost", @param port The port of the smtp server to connect to @param tls_ca Certificate authority file passed to the socket module’s ssl() function. """ - # We set a long timeout because Tor is slow - # XXX: this will not be necessary anymore under python 2.6, because it - # includes a timeout argument on smtplib - socket.setdefaulttimeout(120) - # Send the message via our own SMTP server, but don't include the # envelope header. - smtp = smtplib.SMTP() + # We set a long timeout because Tor is slow + smtp = smtplib.SMTP(timeout=120) smtp.connect(host, port) (resp, reply) = smtp.starttls(cafile = tls_cafile) # Default python let you continue in cleartext if starttls |