Skip to content

Commit 8d0cc95

Browse files
authored
Add 'Date' header to email messages (#683)
Added the 'formatdate' import and set the 'Date' header in the email message. SpamAssassin complains about "Missing Date: header" it this isn't set.
1 parent fdb0d4b commit 8d0cc95

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gramps_webapi/api/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import smtplib
2929
import socket
3030
from email.message import EmailMessage
31-
from email.utils import make_msgid
31+
from email.utils import formatdate, make_msgid
3232
from http import HTTPStatus
3333
from typing import Any, BinaryIO, NoReturn, Sequence
3434

@@ -532,6 +532,7 @@ def send_email(
532532
msg["From"] = from_email
533533
msg["To"] = ", ".join(to)
534534
msg["Message-ID"] = make_msgid()
535+
msg["Date"] = formatdate(localtime=True)
535536

536537
host = get_config("EMAIL_HOST")
537538
port = int(get_config("EMAIL_PORT"))

0 commit comments

Comments
 (0)