mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 03:23:47 +02:00
Use a safe logger when sending email
This commit is contained in:
parent
b99fd3edc2
commit
0d11be0076
1 changed files with 7 additions and 1 deletions
|
|
@ -115,13 +115,19 @@ def sendmail(self, attachment, aname, to, subject, text, log):
|
|||
eto = []
|
||||
for x in to.split(','):
|
||||
eto.append(extract_email_address(x.strip()))
|
||||
def safe_debug(*args, **kwargs):
|
||||
try:
|
||||
return log.debug(*args, **kwargs)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
sendmail(msg, efrom, eto, localhost=None,
|
||||
verbose=1,
|
||||
relay=opts.relay_host,
|
||||
username=opts.relay_username,
|
||||
password=unhexlify(opts.relay_password).decode('utf-8'), port=opts.relay_port,
|
||||
encryption=opts.encryption,
|
||||
debug_output=log.debug)
|
||||
debug_output=safe_debug)
|
||||
finally:
|
||||
self.last_send_time = time.time()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue