Skip to content

Commit 6298c25

Browse files
authored
Merge pull request #294 from Turall/issue-286
#286: allow passing Message-ID Header
2 parents bfb59a6 + 818a12d commit 6298c25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fastapi_mail/msg.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def __init__(self, entries) -> None:
4848
self.subtype = entries.subtype
4949
self.multipart_subtype = entries.multipart_subtype
5050
self.headers = entries.headers
51-
self.msgId = make_msgid()
51+
if self.headers and "message-id" in self.headers:
52+
self.msgId = self.headers["message-id"]
53+
else:
54+
self.msgId = make_msgid()
5255

5356
def _mimetext(self, text: str, subtype: str) -> MIMEText:
5457
"""

0 commit comments

Comments
 (0)