From 2f9d645c50e2646115848ae26a472360af830469 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 2 Apr 2026 13:08:50 -0500 Subject: [PATCH] Configure outbound SMTP email via Swoosh with TLS --- config/prod.exs | 4 ++-- config/runtime.exs | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/config/prod.exs b/config/prod.exs index 25473f71..b79964a0 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -14,8 +14,8 @@ config :microwaveprop, MicrowavepropWeb.Endpoint, cache_static_manifest: "priv/s # config :microwaveprop, MicrowavepropWeb.Endpoint, # force_ssl: [rewrite_on: [:x_forwarded_proto]] -# Configure Swoosh API Client -config :swoosh, api_client: Swoosh.ApiClient.Req +# SMTP adapter doesn't need an API client +config :swoosh, api_client: false # Runtime production configuration, including reading diff --git a/config/runtime.exs b/config/runtime.exs index 5d2a6780..01ed22fb 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -122,14 +122,15 @@ if config_env() == :prod do # # config :microwaveprop, Microwaveprop.Mailer, # adapter: Swoosh.Adapters.Mailgun, - # api_key: System.get_env("MAILGUN_API_KEY"), - # domain: System.get_env("MAILGUN_DOMAIN") - # - # Most non-SMTP adapters require an API client. Swoosh supports Req, Hackney, - # and Finch out-of-the-box. This configuration is typically done at - # compile-time in your config/prod.exs: - # - # config :swoosh, :api_client, Swoosh.ApiClient.Req - # - # See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details. + config :microwaveprop, Microwaveprop.Mailer, + adapter: Swoosh.Adapters.SMTP, + relay: System.get_env("EMAIL_SERVER"), + port: 587, + username: System.get_env("EMAIL_USERNAME"), + password: System.get_env("EMAIL_PASSWORD"), + tls: :if_available, + auth: :always, + ssl: false + + config :microwaveprop, :email_from, {"NTMS Propagation", "graham@w5isp.com"} end