diff --git a/lib/plausible_web/email.ex b/lib/plausible_web/email.ex
index 08568f929..70041a0a7 100644
--- a/lib/plausible_web/email.ex
+++ b/lib/plausible_web/email.ex
@@ -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
diff --git a/lib/plausible_web/templates/layout/base_email.html.eex b/lib/plausible_web/templates/layout/base_email.html.eex
new file mode 100644
index 000000000..c13e1a21b
--- /dev/null
+++ b/lib/plausible_web/templates/layout/base_email.html.eex
@@ -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 %>
+
+
+<%= @inner_content %>
+
+
+Thanks,
+<%= if Application.get_env(:plausible, :is_selfhost) do %>
+Plausible
+<% else %>
+Uku and Marko
+<% end %>
+
+
+--
+
+<%= link(plausible_url(), to: plausible_url()) %>
+
+<%= if Map.get(assigns, :unsubscribe, false) do %>
+{{{ pm:unsubscribe }}}
+<% end %>