2020-01-26 21:36:50 +01:00
|
|
|
defmodule Mobilizon.Web.Email do
|
2019-09-17 02:45:32 +02:00
|
|
|
@moduledoc """
|
|
|
|
The Email context.
|
|
|
|
"""
|
|
|
|
|
2020-01-26 21:36:50 +01:00
|
|
|
use Bamboo.Phoenix, view: Mobilizon.Web.EmailView
|
2019-09-17 02:45:32 +02:00
|
|
|
|
|
|
|
alias Mobilizon.Config
|
|
|
|
|
2019-09-23 19:33:58 +02:00
|
|
|
@spec base_email(keyword()) :: Bamboo.Email.t()
|
|
|
|
def base_email(args) do
|
|
|
|
instance = Config.instance_config()
|
|
|
|
|
2019-09-30 18:18:04 +02:00
|
|
|
args
|
|
|
|
|> new_email()
|
2019-11-19 11:12:59 +01:00
|
|
|
|> from({Config.instance_name(), Config.instance_email_from()})
|
2019-09-23 19:33:58 +02:00
|
|
|
|> put_header("Reply-To", Config.instance_email_reply_to())
|
|
|
|
|> assign(:instance, instance)
|
2020-01-26 21:36:50 +01:00
|
|
|
|> put_html_layout({Mobilizon.Web.EmailView, "email.html"})
|
|
|
|
|> put_text_layout({Mobilizon.Web.EmailView, "email.text"})
|
2019-09-17 02:45:32 +02:00
|
|
|
end
|
|
|
|
end
|