From b695226fec39f52e3b1014e76e930a71f17889f6 Mon Sep 17 00:00:00 2001 From: Alex Lion Date: Fri, 27 Dec 2024 10:40:36 -0500 Subject: [PATCH] Fix empty auth smtp --- CHANGELOG.md | 1 + config/runtime.exs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e93346c..d666a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Add button to trigger product tour instead of automatically starting it - Improve design and UX for interactions and presentation settings in the manager view - Add pagination for events on the dashboard +- Fix STMP adapter to work with secure connection ## v2.2.0 diff --git a/config/runtime.exs b/config/runtime.exs index 9fc5de9..8fd9681 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -190,8 +190,21 @@ case mail_transport do config :claper, Claper.Mailer, adapter: Swoosh.Adapters.Mua, relay: smtp_relay, - port: smtp_port, - auth: [username: smtp_username, password: smtp_password] + port: smtp_port + + cond do + smtp_username && smtp_password -> + config :claper, Claper.Mailer, auth: [username: smtp_username, password: smtp_password] + + smtp_username || smtp_password -> + raise ArgumentError, """ + Both SMTP_USERNAME and SMTP_PASSWORD must be set for SMTP authentication. + Please provide values for both environment variables. + """ + + true -> + nil + end config :swoosh, :api_client, false