From 10c156d98fee44444ed6d1366e615ddcdb2ee68a Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 10 Dec 2018 20:20:50 +0300 Subject: [#114] SMTP deps and config. --- config/config.exs | 2 ++ config/prod.exs | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'config') diff --git a/config/config.exs b/config/config.exs index 1401b0a3d..410b3c618 100644 --- a/config/config.exs +++ b/config/config.exs @@ -101,6 +101,8 @@ config :pleroma, :instance, finmoji_enabled: true, mrf_transparency: true +config :pleroma, Pleroma.Mailer, adapter: Swoosh.Adapters.Local + config :pleroma, :markup, # XXX - unfortunately, inline images must be enabled by default right now, because # of custom emoji. Issue #275 discusses defanging that somehow. diff --git a/config/prod.exs b/config/prod.exs index d0cfd1ac2..e281a4a03 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -17,6 +17,47 @@ config :pleroma, Pleroma.Web.Endpoint, http: [port: 4000], protocol: "http" +# Supported adapters: https://github.com/swoosh/swoosh#adapters +mailer_settings = + case String.downcase(System.get_env("PLEROMA_SWOOSH_ADAPTER") || "") do + "mailgun" -> + [ + adapter: Swoosh.Adapters.Mailgun, + api_key: System.get_env("PLEROMA_MAILGUN_API_KEY"), + domain: System.get_env("PLEROMA_MAILGUN_DOMAIN") + ] + + "mandrill" -> + [ + adapter: Swoosh.Adapters.Mandrill, + api_key: System.get_env("PLEROMA_MANDRILL_API_KEY") + ] + + "sendgrid" -> + [ + adapter: Swoosh.Adapters.Sendgrid, + api_key: System.get_env("PLEROMA_SENDGRID_API_KEY") + ] + + "smtp" -> + [ + adapter: Swoosh.Adapters.SMTP, + relay: System.get_env("PLEROMA_SMTP_RELAY"), + username: System.get_env("PLEROMA_SMTP_USERNAME"), + password: System.get_env("PLEROMA_SMTP_PASSWORD"), + port: System.get_env("PLEROMA_SMTP_PORT") || 1025, + ssl: true, + tls: :always, + auth: :always, + retries: 3 + ] + + _ -> + [adapter: Swoosh.Adapters.Local] + end + +config :pleroma, Pleroma.Mailer, mailer_settings + # Do not print debug messages in production config :logger, level: :info -- cgit v1.2.3 From 12905ce1ad39106251e401fec81b871799708cc4 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 11 Dec 2018 14:59:25 +0300 Subject: [#114] Added /dev/mailbox dev-only route (emails preview). Added mailer config examples. --- config/config.md | 25 +++++++++++++++++++++++++ config/prod.exs | 41 ----------------------------------------- 2 files changed, 25 insertions(+), 41 deletions(-) (limited to 'config') diff --git a/config/config.md b/config/config.md index dbbfa9194..2e7f6244c 100644 --- a/config/config.md +++ b/config/config.md @@ -30,6 +30,31 @@ This filter replaces the filename (not the path) of an upload. For complete obfu * `text`: Text to replace filenames in links. If empty, `{random}.extension` will be used. +## Pleroma.Mailer +* `adapter`: one of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters), or `Swoosh.Adapters.Local` for in-memory mailbox. +* `api_key` / `password` and / or other adapter-specific settings, per the above documentation. + +An example for Sendgrid adapter: + +``` +config :pleroma, Pleroma.Mailer, + adapter: Swoosh.Adapters.Sendgrid, + api_key: "YOUR_API_KEY" +``` + +An example for SMTP adapter: +``` +config :pleroma, Pleroma.Mailer, + adapter: Swoosh.Adapters.SMTP, + relay: "smtp.gmail.com", + username: "YOUR_USERNAME@gmail.com", + password: "YOUR_SMTP_PASSWORD", + port: 465, + ssl: true, + tls: :always, + auth: :always +``` + ## :uri_schemes * `valid_schemes`: List of the scheme part that is considered valid to be an URL diff --git a/config/prod.exs b/config/prod.exs index e281a4a03..d0cfd1ac2 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -17,47 +17,6 @@ config :pleroma, Pleroma.Web.Endpoint, http: [port: 4000], protocol: "http" -# Supported adapters: https://github.com/swoosh/swoosh#adapters -mailer_settings = - case String.downcase(System.get_env("PLEROMA_SWOOSH_ADAPTER") || "") do - "mailgun" -> - [ - adapter: Swoosh.Adapters.Mailgun, - api_key: System.get_env("PLEROMA_MAILGUN_API_KEY"), - domain: System.get_env("PLEROMA_MAILGUN_DOMAIN") - ] - - "mandrill" -> - [ - adapter: Swoosh.Adapters.Mandrill, - api_key: System.get_env("PLEROMA_MANDRILL_API_KEY") - ] - - "sendgrid" -> - [ - adapter: Swoosh.Adapters.Sendgrid, - api_key: System.get_env("PLEROMA_SENDGRID_API_KEY") - ] - - "smtp" -> - [ - adapter: Swoosh.Adapters.SMTP, - relay: System.get_env("PLEROMA_SMTP_RELAY"), - username: System.get_env("PLEROMA_SMTP_USERNAME"), - password: System.get_env("PLEROMA_SMTP_PASSWORD"), - port: System.get_env("PLEROMA_SMTP_PORT") || 1025, - ssl: true, - tls: :always, - auth: :always, - retries: 3 - ] - - _ -> - [adapter: Swoosh.Adapters.Local] - end - -config :pleroma, Pleroma.Mailer, mailer_settings - # Do not print debug messages in production config :logger, level: :info -- cgit v1.2.3 From 4e7d98922ec621a5c9bc6638a40c09890f0f17a4 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 12 Dec 2018 16:28:00 +0300 Subject: [#114] Added tests for "POST /api/account/password_reset". --- config/test.exs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config') diff --git a/config/test.exs b/config/test.exs index ca10a616c..5c6acfead 100644 --- a/config/test.exs +++ b/config/test.exs @@ -11,6 +11,8 @@ config :logger, level: :warn config :pleroma, Pleroma.Uploaders.Local, uploads: "test/uploads" +config :pleroma, Pleroma.Mailer, adapter: Swoosh.Adapters.Test + # Configure your database config :pleroma, Pleroma.Repo, adapter: Ecto.Adapters.Postgres, -- cgit v1.2.3 From f81213910fb32505b92fc19270cc483e00862d0c Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Fri, 14 Dec 2018 12:09:55 +0300 Subject: [#114] Addressed MR comments. Removed functionality to be extracted to other MRs. --- config/config.exs | 2 -- config/dev.exs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/config/config.exs b/config/config.exs index 410b3c618..1401b0a3d 100644 --- a/config/config.exs +++ b/config/config.exs @@ -101,8 +101,6 @@ config :pleroma, :instance, finmoji_enabled: true, mrf_transparency: true -config :pleroma, Pleroma.Mailer, adapter: Swoosh.Adapters.Local - config :pleroma, :markup, # XXX - unfortunately, inline images must be enabled by default right now, because # of custom emoji. Issue #275 discusses defanging that somehow. diff --git a/config/dev.exs b/config/dev.exs index 166be721a..080a2f8db 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -17,6 +17,8 @@ config :pleroma, Pleroma.Web.Endpoint, check_origin: false, watchers: [] +config :pleroma, Pleroma.Mailer, adapter: Swoosh.Adapters.Local + # ## SSL Support # # In order to use HTTPS in development, a self-signed -- cgit v1.2.3 From 658edb166fc91e77399ff6022a48076db5404fb1 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Fri, 7 Dec 2018 15:55:28 +0700 Subject: fix and improve web push; add configuration docs --- config/config.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'config') diff --git a/config/config.md b/config/config.md index 165f5d9f8..2401e9aed 100644 --- a/config/config.md +++ b/config/config.md @@ -154,3 +154,11 @@ An example: config :pleroma, :mrf_user_allowlist, "example.org": ["https://example.org/users/admin"] ``` + +## :web_push_encryption + +Web Push Notifications configuration. You could use a mix task `mix web_push.gen.keypair` to generate it. + +* ``subject``: a mailto link for the administrative contact. It’s best if this email is not a personal email address, but rather a group email so that if a person leaves an organization, is unavailable for an extended period, or otherwise can’t respond, someone else on the list can. +* ``public_key``: VAPID public key +* ``private_key``: VAPID private key -- cgit v1.2.3 From 3b65f316069a7c754d29515ad33b852661fff5ef Mon Sep 17 00:00:00 2001 From: lambda Date: Fri, 7 Dec 2018 09:32:59 +0000 Subject: Update config.md --- config/config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config') diff --git a/config/config.md b/config/config.md index 2401e9aed..25e0b5012 100644 --- a/config/config.md +++ b/config/config.md @@ -157,7 +157,7 @@ config :pleroma, :mrf_user_allowlist, ## :web_push_encryption -Web Push Notifications configuration. You could use a mix task `mix web_push.gen.keypair` to generate it. +Web Push Notifications configuration. You can use the mix task `mix web_push.gen.keypair` to generate it. * ``subject``: a mailto link for the administrative contact. It’s best if this email is not a personal email address, but rather a group email so that if a person leaves an organization, is unavailable for an extended period, or otherwise can’t respond, someone else on the list can. * ``public_key``: VAPID public key -- cgit v1.2.3 From ef10e08efe11d6b796a47a41994caf4cb418ca01 Mon Sep 17 00:00:00 2001 From: Haelwenn Date: Fri, 14 Dec 2018 15:06:04 +0000 Subject: Update config.md --- config/config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config') diff --git a/config/config.md b/config/config.md index 25e0b5012..d4dad77b1 100644 --- a/config/config.md +++ b/config/config.md @@ -155,7 +155,7 @@ config :pleroma, :mrf_user_allowlist, "example.org": ["https://example.org/users/admin"] ``` -## :web_push_encryption +## :web_push_encryption, :vapid_details Web Push Notifications configuration. You can use the mix task `mix web_push.gen.keypair` to generate it. -- cgit v1.2.3