/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/smtp_connection.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import smtplib
24
24
import socket
25
25
 
26
 
from breezy import (
 
26
from . import (
27
27
    config,
28
28
    osutils,
29
29
    )
30
 
from breezy.errors import (
 
30
from .errors import (
31
31
    NoDestinationAddress,
32
32
    SMTPError,
33
33
    DefaultSMTPConnectionRefused,
90
90
        self._connection = self._smtp_factory()
91
91
        try:
92
92
            self._connection.connect(self._smtp_server)
93
 
        except socket.error, e:
 
93
        except socket.error as e:
94
94
            if e.args[0] == errno.ECONNREFUSED:
95
95
                if self._config_smtp_server is None:
96
96
                    raise DefaultSMTPConnectionRefused(socket.error,
181
181
            self._connect()
182
182
            self._connection.sendmail(from_email, to_emails,
183
183
                                      message.as_string())
184
 
        except smtplib.SMTPRecipientsRefused, e:
 
184
        except smtplib.SMTPRecipientsRefused as e:
185
185
            raise SMTPError('server refused recipient: %d %s' %
186
186
                    e.recipients.values()[0])
187
 
        except smtplib.SMTPResponseException, e:
 
187
        except smtplib.SMTPResponseException as e:
188
188
            raise SMTPError('%d %s' % (e.smtp_code, e.smtp_error))
189
 
        except smtplib.SMTPException, e:
 
189
        except smtplib.SMTPException as e:
190
190
            raise SMTPError(str(e))