Merge lp:~mbp/bzr-email/335332-starttls into lp:bzr-email

Proposed by Martin Pool
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mbp/bzr-email/335332-starttls
Merge into: lp:bzr-email
Diff against target: None lines
To merge this branch: bzr merge lp:~mbp/bzr-email/335332-starttls
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+4331@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

fix bugs yay do it thx

Revision history for this message
Martin Pool (mbp) wrote :

=== modified file 'smtp_connection.py'
--- smtp_connection.py 2008-04-29 14:02:52 +0000
+++ smtp_connection.py 2009-03-10 02:24:12 +0000
@@ -80,7 +80,16 @@
         # If this fails, it just returns an error, but it shouldn't raise an
         # exception unless something goes really wrong (in which case we want
         # to fail anyway).
- self._connection.starttls()
+ try:
+ self._connection.starttls()
+ except smtplib.SMTPException, e:
+ if e.args[0] == 'STARTTLS extension not supported by server.':
+ # python2.6 changed to raising an exception here; we can't
+ # really do anything else without it so just continue
+ # <https://bugs.edge.launchpad.net/bzr-email/+bug/335332>
+ pass
+ else:
+ raise

     def _authenticate(self):
         """If necessary authenticate yourself to the server."""

Revision history for this message
Robert Collins (lifeless) wrote :

foodoo

review: Approve
Revision history for this message
John D (v-jbd) wrote :

I used this to bypass STARTTLS if not available on the mail server

        # If this fails, it just returns an error, but it shouldn't raise an
        # exception unless something goes really wrong (in which case we want
        # to fail anyway).
        if self._connection.has_extn('STARTTLS'):
            self._connection.starttls()
            self._connection.ehlo()

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'smtp_connection.py'
2--- smtp_connection.py 2008-04-29 14:02:52 +0000
3+++ smtp_connection.py 2009-03-10 02:24:28 +0000
4@@ -80,7 +80,16 @@
5 # If this fails, it just returns an error, but it shouldn't raise an
6 # exception unless something goes really wrong (in which case we want
7 # to fail anyway).
8- self._connection.starttls()
9+ try:
10+ self._connection.starttls()
11+ except smtplib.SMTPException, e:
12+ if e.args[0] == 'STARTTLS extension not supported by server.':
13+ # python2.6 changed to raising an exception here; we can't
14+ # really do anything else without it so just continue
15+ # <https://bugs.edge.launchpad.net/bzr-email/+bug/335332>
16+ pass
17+ else:
18+ raise
19
20 def _authenticate(self):
21 """If necessary authenticate yourself to the server."""

Subscribers

People subscribed via source and target branches

to all changes: