Also fix saving in outbox

This commit is contained in:
Kovid Goyal 2021-02-23 22:09:03 +05:30
parent 98da158ca6
commit b0996fa9ad
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -124,7 +124,7 @@ def get_mx(host, verbose=0):
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):
import polyglot.smtplib as smtplib
hosts = get_mx(to.split('@')[-1].strip(), verbose)
@ -323,6 +323,8 @@ def main(args=sys.argv):
if os.fork() != 0:
return 0
if isinstance(msg, str):
msg = msg.encode('utf-8')
try:
sendmail(msg, efrom, eto, localhost=opts.localhost, verbose=opts.verbose,
timeout=opts.timeout, relay=opts.relay, username=opts.username,