Skip to content

Commit

Permalink
Rectify email message ID, change multipart order (#3094)
Browse files Browse the repository at this point in the history
  • Loading branch information
be-joeri authored Feb 1, 2024
1 parent 95b7990 commit 073efd7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mealie/services/email/email_senders.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ def send(self, to: str, smtp: EmailOptions) -> SMTPResponse:
msg["From"] = f"{self.mail_from_name} <{self.mail_from_address}>"
msg["To"] = to
msg["Date"] = formatdate(localtime=True)
msg.add_alternative(self.html, subtype="html")
msg.add_alternative(html2text(self.html), subtype="plain")
msg.add_alternative(self.html, subtype="html")

try:
message_id = f"{uuid4()}@{self.mail_from_address.split('@')[1]}"
message_id = f"<{uuid4()}@{self.mail_from_address.split('@')[1]}>"
except IndexError:
# this should never happen with a valid email address,
# but we let the SMTP server handle it instead of raising it here
message_id = f"{uuid4()}@{self.mail_from_address}"
message_id = f"<{uuid4()}@{self.mail_from_address}>"

msg["Message-ID"] = message_id
msg["MIME-Version"] = "1.0"
Expand Down

0 comments on commit 073efd7

Please sign in to comment.