mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Also fix saving in outbox
This commit is contained in:
parent
98da158ca6
commit
b0996fa9ad
@ -124,7 +124,7 @@ def get_mx(host, verbose=0):
|
|||||||
return [unicode_type(x.exchange) for x in answers if hasattr(x, 'exchange')]
|
return [unicode_type(x.exchange) for x in answers if hasattr(x, 'exchange')]
|
||||||
|
|
||||||
|
|
||||||
def sendmail_direct(from_, to, msg, timeout, localhost, verbose,
|
def sendmail_direct(from_, to, msg: bytes, timeout, localhost, verbose,
|
||||||
debug_output=None):
|
debug_output=None):
|
||||||
import polyglot.smtplib as smtplib
|
import polyglot.smtplib as smtplib
|
||||||
hosts = get_mx(to.split('@')[-1].strip(), verbose)
|
hosts = get_mx(to.split('@')[-1].strip(), verbose)
|
||||||
@ -323,6 +323,8 @@ def main(args=sys.argv):
|
|||||||
if os.fork() != 0:
|
if os.fork() != 0:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
if isinstance(msg, str):
|
||||||
|
msg = msg.encode('utf-8')
|
||||||
try:
|
try:
|
||||||
sendmail(msg, efrom, eto, localhost=opts.localhost, verbose=opts.verbose,
|
sendmail(msg, efrom, eto, localhost=opts.localhost, verbose=opts.verbose,
|
||||||
timeout=opts.timeout, relay=opts.relay, username=opts.username,
|
timeout=opts.timeout, relay=opts.relay, username=opts.username,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user