From f3a3fe33b66c5b685f4d65a839d8a974aa870ab3 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 8 Dec 2024 12:13:52 -0500 Subject: [PATCH] Fix message id format --- lib/philomena/users/user_notifier.ex | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/philomena/users/user_notifier.ex b/lib/philomena/users/user_notifier.ex index 8ee56871..96c2e88a 100644 --- a/lib/philomena/users/user_notifier.ex +++ b/lib/philomena/users/user_notifier.ex @@ -3,21 +3,25 @@ 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: {"noreply", mailer_address()}, subject: subject, text_body: body ) - |> Email.header("Message-ID", id) + |> Email.header("Message-ID", message_id()) |> Mailer.deliver_later() end + defp message_id do + id = + :crypto.strong_rand_bytes(16) + |> Base.encode16() + |> String.downcase() + + "#{id}.#{mailer_address()}" + end + defp mailer_address do Application.get_env(:philomena, :mailer_address) end