equal
deleted
inserted
replaced
190 import stat |
190 import stat |
191 import sys |
191 import sys |
192 from threading import Lock |
192 from threading import Lock |
193 from warnings import filterwarnings |
193 from warnings import filterwarnings |
194 |
194 |
195 from six import text_type |
195 from six import PY2, text_type |
196 |
196 |
197 from logilab.common.decorators import cached, classproperty |
197 from logilab.common.decorators import cached, classproperty |
198 from logilab.common.deprecation import deprecated |
198 from logilab.common.deprecation import deprecated |
199 from logilab.common.logging_ext import set_log_methods, init_log |
199 from logilab.common.logging_ext import set_log_methods, init_log |
200 from logilab.common.configuration import (Configuration, Method, |
200 from logilab.common.configuration import (Configuration, Method, |
1342 self.exception("can't connect to smtp server %s:%s (%s)", |
1342 self.exception("can't connect to smtp server %s:%s (%s)", |
1343 server, port, ex) |
1343 server, port, ex) |
1344 if self.mode == 'test': |
1344 if self.mode == 'test': |
1345 raise |
1345 raise |
1346 return False |
1346 return False |
1347 for msg, recipients in msgs: |
1347 for mimedoc, recipients in msgs: |
|
1348 msg = mimedoc.as_string() if PY2 else mimedoc.as_bytes() |
1348 try: |
1349 try: |
1349 smtp.sendmail(fromaddr, recipients, msg.as_string()) |
1350 smtp.sendmail(fromaddr, recipients, msg) |
1350 except Exception as ex: |
1351 except Exception as ex: |
1351 self.exception("error sending mail to %s (%s)", |
1352 self.exception("error sending mail to %s (%s)", |
1352 recipients, ex) |
1353 recipients, ex) |
1353 if self.mode == 'test': |
1354 if self.mode == 'test': |
1354 raise |
1355 raise |