fix(projekt-matching): add Date and Message-ID headers to outgoing mail
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import email
|
||||
import email.utils
|
||||
import imaplib
|
||||
import smtplib
|
||||
import ssl
|
||||
@@ -71,6 +72,8 @@ class MailBox:
|
||||
def send_mail(user, password, to, subject, body):
|
||||
msg = EmailMessage()
|
||||
msg["From"], msg["To"], msg["Subject"] = user, to, subject
|
||||
msg["Date"] = email.utils.formatdate(localtime=True)
|
||||
msg["Message-ID"] = email.utils.make_msgid(domain="destengs.com")
|
||||
msg.set_content(body)
|
||||
with smtplib.SMTP(SMTP_HOST, SMTP_PORT, timeout=30) as server:
|
||||
server.starttls(context=ssl.create_default_context())
|
||||
|
||||
Reference in New Issue
Block a user