mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
py3 compat when sending emails with non-ascii content
This commit is contained in:
parent
1d3f6d3dd9
commit
98da158ca6
@ -163,6 +163,8 @@ def get_smtp_class(use_ssl=False, debuglevel=0):
|
|||||||
def sendmail(msg, from_, to, localhost=None, verbose=0, timeout=None,
|
def sendmail(msg, from_, to, localhost=None, verbose=0, timeout=None,
|
||||||
relay=None, username=None, password=None, encryption='TLS',
|
relay=None, username=None, password=None, encryption='TLS',
|
||||||
port=-1, debug_output=None, verify_server_cert=False, cafile=None):
|
port=-1, debug_output=None, verify_server_cert=False, cafile=None):
|
||||||
|
if isinstance(msg, str):
|
||||||
|
msg = msg.encode('utf-8')
|
||||||
if relay is None:
|
if relay is None:
|
||||||
for x in to:
|
for x in to:
|
||||||
return sendmail_direct(from_, x, msg, timeout, localhost, verbose)
|
return sendmail_direct(from_, x, msg, timeout, localhost, verbose)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user