Skip to content

Commit

Permalink
chore: preserve recipients order
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Nov 14, 2024
1 parent 64c049b commit 6011ebc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,10 @@ def transfer_to_mail_server(self) -> None:
message["X-Priority"] = "3"
message = message.as_string()

recipients = list(set([rcpt.email for rcpt in self.recipients]))
# Remove duplicate recipients while preserving the order by using `dict.fromkeys()`.
# This avoids using a set, which could change the order of recipients.
recipients = list(dict.fromkeys([rcpt.email for rcpt in self.recipients]))

outbound_api = get_mail_server_outbound_api()
token = outbound_api.send(self.name, recipients, message)

Expand Down

0 comments on commit 6011ebc

Please sign in to comment.