Add postmark adapter for email

This commit is contained in:
Alex
2023-10-27 16:12:22 +02:00
parent 95bbb5e20e
commit 7d97d3d9bd
7 changed files with 50 additions and 43 deletions

View File

@@ -20,18 +20,6 @@ config :claper, ClaperWeb.Gettext,
default_locale: "en",
locales: ~w(fr en de)
# Configures the mailer
#
# By default it uses the "Local" adapter which stores the emails
# locally. You can see the emails in your browser, at "/dev/mailbox".
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :claper, Claper.Mailer, adapter: Swoosh.Adapters.Local
# Swoosh API client is needed for adapters other than SMTP.
config :swoosh, :api_client, false
config :dart_sass,
version: "1.58.0",
default: [

View File

@@ -110,18 +110,32 @@ config :claper, ClaperWeb.MailboxGuard,
get_var_from_path_or_env(config_dir, "ENABLE_MAILBOX_ROUTE", "false")
|> String.to_existing_atom()
if mail_transport == "smtp" do
config :claper, Claper.Mailer,
adapter: Swoosh.Adapters.SMTP,
relay: smtp_relay,
username: smtp_username,
password: smtp_password,
ssl: smtp_ssl,
# always, never, if_available
tls: smtp_tls,
# always, never, if_available
auth: smtp_auth,
port: smtp_port
case mail_transport do
"smtp" ->
config :claper, Claper.Mailer,
adapter: Swoosh.Adapters.SMTP,
relay: smtp_relay,
username: smtp_username,
password: smtp_password,
ssl: smtp_ssl,
# always, never, if_available
tls: smtp_tls,
# always, never, if_available
auth: smtp_auth,
port: smtp_port
config :swoosh, :api_client, false
"postmark" ->
config :claper, Claper.Mailer,
adapter: Swoosh.Adapters.Postmark,
api_key: get_var_from_path_or_env(config_dir, "POSTMARK_API_KEY", nil)
config :swoosh, :api_client, Swoosh.ApiClient.Hackney
_ ->
config :claper, Claper.Mailer, adapter: Swoosh.Adapters.Local
config :swoosh, :api_client, false
end
config :ex_aws,