mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-18 15:08:00 +01:00
Fix message id format
This commit is contained in:
parent
aa09135cc2
commit
f3a3fe33b6
1 changed files with 10 additions and 6 deletions
|
@ -3,21 +3,25 @@ defmodule Philomena.Users.UserNotifier do
|
||||||
alias Philomena.Mailer
|
alias Philomena.Mailer
|
||||||
|
|
||||||
defp deliver(to, subject, body) do
|
defp deliver(to, subject, body) do
|
||||||
id =
|
|
||||||
:crypto.strong_rand_bytes(16)
|
|
||||||
|> Base.encode16()
|
|
||||||
|> String.downcase()
|
|
||||||
|
|
||||||
Email.new(
|
Email.new(
|
||||||
to: to,
|
to: to,
|
||||||
from: {"noreply", mailer_address()},
|
from: {"noreply", mailer_address()},
|
||||||
subject: subject,
|
subject: subject,
|
||||||
text_body: body
|
text_body: body
|
||||||
)
|
)
|
||||||
|> Email.header("Message-ID", id)
|
|> Email.header("Message-ID", message_id())
|
||||||
|> Mailer.deliver_later()
|
|> Mailer.deliver_later()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp message_id do
|
||||||
|
id =
|
||||||
|
:crypto.strong_rand_bytes(16)
|
||||||
|
|> Base.encode16()
|
||||||
|
|> String.downcase()
|
||||||
|
|
||||||
|
"#{id}.#{mailer_address()}"
|
||||||
|
end
|
||||||
|
|
||||||
defp mailer_address do
|
defp mailer_address do
|
||||||
Application.get_env(:philomena, :mailer_address)
|
Application.get_env(:philomena, :mailer_address)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue