fix: e-mails carry a Date header, which spam filters expect
Some checks failed
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 3m21s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Failing after 54s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-21 14:08:34 -03:00
parent abae1c29a1
commit 578a90bcc9
2 changed files with 5 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ import os
import smtplib
import ssl
from email.message import EmailMessage
from email.utils import formataddr, make_msgid, parseaddr
from email.utils import formataddr, formatdate, make_msgid, parseaddr
ADAPTER = os.environ.get('MAIL_ADAPTER', 'off')
RESET_MINUTES = 60
@@ -102,6 +102,8 @@ def message(to, subject, body, html=None):
msg['From'] = formataddr((name or 'DTF Dropstar', address))
msg['To'] = to
msg['Subject'] = subject
# Neither EmailMessage nor smtplib adds it, and filters (Outlook's among them) count it missing.
msg['Date'] = formatdate(localtime=True)
msg['Message-ID'] = make_msgid(domain=address.split('@')[-1] or None)
reply = os.environ.get('MAIL_REPLY_TO', '')
if reply: