Skip to content

Commit be98f10

Browse files
committed
sendmail explicit text/html
1 parent cd52e24 commit be98f10

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sendmail.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from os import environ as os_env
2+
from sys import stdout
23
from datetime import datetime
34
from smtplib import SMTP
45

@@ -25,14 +26,15 @@ def __init__(self, env: dict[str, str]):
2526
To: {to_addr}
2627
Subject: {subj}
2728
Date: {date}
29+
Content-Type: text/html
2830
2931
{message_text}""".encode('ascii', 'xmlcharrefreplace')
3032

31-
#TODO: send email with utf-8
3233
print(f"[sendmail.py]> sending email from <{CONFIG.SENDER}> to <{CONFIG.TO}>")
3334
smtp = SMTP()
3435
smtp.connect(CONFIG.SERVER, CONFIG.SERVER_PORT)
36+
#smtp.starttls()
3537
smtp.login(CONFIG.SENDER, CONFIG.PASSWORD)
3638
smtp.sendmail(from_addr, [to_addr], msg)
37-
print(f"[sendmail.py]> email sent")
39+
print("[sendmail.py]> email sent")
3840
smtp.quit()

0 commit comments

Comments
 (0)