From aa09135cc2223139d1062a74b2d2ccdcb4b0949b Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 8 Dec 2024 12:04:22 -0500 Subject: [PATCH] Ensure swoosh mail compatibility with DKIM relay --- lib/philomena/users/user_notifier.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/philomena/users/user_notifier.ex b/lib/philomena/users/user_notifier.ex index 2cd85d86..8ee56871 100644 --- a/lib/philomena/users/user_notifier.ex +++ b/lib/philomena/users/user_notifier.ex @@ -3,12 +3,18 @@ defmodule Philomena.Users.UserNotifier do alias Philomena.Mailer defp deliver(to, subject, body) do + id = + :crypto.strong_rand_bytes(16) + |> Base.encode16() + |> String.downcase() + Email.new( to: to, - from: mailer_address(), + from: {"noreply", mailer_address()}, subject: subject, text_body: body ) + |> Email.header("Message-ID", id) |> Mailer.deliver_later() end