Allow email body to contain emoji

This commit is contained in:
Dennis Reimann 2020-06-29 19:01:38 +02:00
parent f8e953a0e4
commit 8baf05bafb
No known key found for this signature in database
GPG Key ID: 5009E1797F03F8D0

View File

@ -107,7 +107,7 @@ def mail(recipient=None, message=None, subject=None, cert=None, encrypt=False,
'From: {} <{}>'.format(from_name, from_address),
"Subject: {}".format(subject),
"",
"{}".format(message)
"{}".format(message.encode('utf8'))
]
with open(cert, 'rb') as pem:
@ -122,7 +122,7 @@ def mail(recipient=None, message=None, subject=None, cert=None, encrypt=False,
msg['From'] = '{} <{}>'.format(from_name, from_address),
msg['To'] = recipient
msg.set_payload(message)
msg.set_payload(message.encode('utf8'))
msg_to_send = msg.as_bytes()
# send message via e-Mail