add a default base_email layout to every email

pull/2431/head
Robert 4 years ago
parent fbe3a4e6f1
commit 31c8ebe842

@ -305,11 +305,21 @@ defmodule PlausibleWeb.Email do
})
end
defp base_email() do
defp base_email(), do: base_email(%{layout: "base_email.html"})
defp base_email(%{layout: layout}) do
mailer_from = Application.get_env(:plausible, :mailer_email)
new_email()
|> put_param("TrackOpens", false)
|> from(mailer_from)
|> maybe_put_layout(layout)
end
defp maybe_put_layout(email, nil), do: email
defp maybe_put_layout(email, layout) do
email
|> put_html_layout({PlausibleWeb.LayoutView, layout})
end
end

@ -0,0 +1,24 @@
<%= case Map.get(assigns, :user) do
%{name: name} when is_binary(name) -> "Hey #{String.split(name) |> List.first()},"
_any -> "Hey,"
end %>
<br /><br />
<%= @inner_content %>
<br /><br />
Thanks,<br />
<%= if Application.get_env(:plausible, :is_selfhost) do %>
Plausible
<% else %>
Uku and Marko
<% end %>
<br /><br />
--
<br /><br />
<%= link(plausible_url(), to: plausible_url()) %><br />
<%= if Map.get(assigns, :unsubscribe, false) do %>
{{{ pm:unsubscribe }}}
<% end %>
Loading…
Cancel
Save