Skip to content

Commit

Permalink
Fix empty auth smtp
Browse files Browse the repository at this point in the history
  • Loading branch information
alxlion committed Dec 27, 2024
1 parent a669d64 commit b695226
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 15 additions & 2 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b695226

Please sign in to comment.