forked from plausible/analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change SMTP defaults (plausible#4538)
* default smtp config updates * tests * improve SMTP_MIDDLEBOX_COMP_MODE decoding * changelog * format --------- Co-authored-by: Adrian Gruntkowski <[email protected]>
- Loading branch information
1 parent
4864a2c
commit 67d7c65
Showing
3 changed files
with
36 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,14 @@ defmodule Plausible.ConfigTest do | |
describe "mailer" do | ||
test "mailer email default" do | ||
env = [{"MAILER_EMAIL", nil}] | ||
assert get_in(runtime_config(env), [:plausible, :mailer_email]) == "[email protected]" | ||
assert get_in(runtime_config(env), [:plausible, :mailer_email]) == "plausible@localhost" | ||
end | ||
|
||
test "mailer email from base url" do | ||
env = [{"MAILER_EMAIL", nil}, {"BASE_URL", "https://plausible.example.com:8443"}] | ||
|
||
assert get_in(runtime_config(env), [:plausible, :mailer_email]) == | ||
"[email protected]" | ||
end | ||
|
||
test "mailer email custom" do | ||
|
@@ -16,29 +23,20 @@ defmodule Plausible.ConfigTest do | |
env = [{"MAILER_EMAIL", nil}, {"MAILER_NAME", "John"}] | ||
|
||
assert get_in(runtime_config(env), [:plausible, :mailer_email]) == | ||
{"John", "hello@plausible.local"} | ||
{"John", "plausible@localhost"} | ||
|
||
env = [{"MAILER_EMAIL", "[email protected]"}, {"MAILER_NAME", "John"}] | ||
|
||
assert get_in(runtime_config(env), [:plausible, :mailer_email]) == | ||
{"John", "[email protected]"} | ||
end | ||
|
||
test "defaults to Bamboo.SMTPAdapter" do | ||
test "defaults to Bamboo.Mua" do | ||
env = {"MAILER_ADAPTER", nil} | ||
|
||
assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [ | ||
adapter: Bamboo.SMTPAdapter, | ||
server: "mail", | ||
hostname: "localhost", | ||
port: "25", | ||
username: nil, | ||
password: nil, | ||
tls: :if_available, | ||
allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"], | ||
ssl: false, | ||
retries: 2, | ||
no_mx_lookups: true | ||
adapter: Bamboo.Mua, | ||
ssl: [middlebox_comp_mode: false] | ||
] | ||
end | ||
|
||
|
@@ -144,7 +142,17 @@ defmodule Plausible.ConfigTest do | |
env = [{"MAILER_ADAPTER", "Bamboo.Mua"}] | ||
|
||
assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [ | ||
{:adapter, Bamboo.Mua} | ||
{:adapter, Bamboo.Mua}, | ||
{:ssl, [middlebox_comp_mode: false]} | ||
] | ||
end | ||
|
||
test "Bamboo.Mua (middlebox_comp_mode enabled)" do | ||
env = [{"MAILER_ADAPTER", "Bamboo.Mua"}, {"SMTP_MIDDLEBOX_COMP_MODE", "true"}] | ||
|
||
assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [ | ||
{:adapter, Bamboo.Mua}, | ||
{:ssl, [middlebox_comp_mode: true]} | ||
] | ||
end | ||
|
||
|
@@ -159,6 +167,7 @@ defmodule Plausible.ConfigTest do | |
|
||
assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [ | ||
{:adapter, Bamboo.Mua}, | ||
{:ssl, [middlebox_comp_mode: false]}, | ||
{:relay, "localhost"}, | ||
{:port, 2525}, | ||
{:auth, [username: "neo", password: "one"]} | ||
|
@@ -176,6 +185,7 @@ defmodule Plausible.ConfigTest do | |
|
||
assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [ | ||
adapter: Bamboo.Mua, | ||
ssl: [middlebox_comp_mode: false], | ||
relay: "localhost", | ||
port: 2525 | ||
] | ||
|