I’m using Pow for user authentication in my app. Up until recently I’ve been developing on an iMac without any issues (i.e. I was able to create users, receive the confirmation email, reset their passwords, etc.) but I recently decided to get a new laptop (a MacBook Pro) to develop on. I was able to setup my development environment without any issues, but when I went to create a new user and confirm the new account the confirmation email didn’t get sent. I see this message in the logs:
[warn] Mailer backend failed with: {:option, :server_only, :honor_cipher_order}
Here’s the custom mailer backend as well:
defmodule TrumpetWeb.PowMailer do
use Pow.Phoenix.Mailer
use Swoosh.Mailer, otp_app: :trumpet_web
import Swoosh.Email
require Logger
def cast(%{user: user, subject: subject, text: text, html: html, assigns: _assigns}) do
%Swoosh.Email{}
|> to({user.name, user.email})
|> from({"Dev - Trumpet", "noreply@email.com"})
|> subject(subject)
|> html_body(html)
|> text_body(text)
end
def process(email) do
email
|> deliver()
|> log_warnings()
end
defp log_warnings({:error, reason}) do
Logger.warn("Mailer backend failed with: #{inspect(reason)}") # This is the log message I'm getting. `reason` doesn't provide much info.
end
defp log_warnings({:ok, response}), do: {:ok, response}
end
I’ve search for the cause of that reason
but haven’t been able to find anything useful. I also added inspect
to various places in the process
function and can confirm the email is generated and the confirmation link works (i.e. I can click the confirmation link from the logs and confirm the user without any issues). What’s also weird is that if I push the changes from my laptop to GitHub, pull them down on to my iMac, and build and run the app then the code works(?!).
Any ideas on what could be going on? I’m using an umbrella app, so here’s the web component’s deps:
defp deps do
[
{:phoenix, "~> 1.4.9"},
{:phoenix_pubsub, "~> 1.1"},
{:phoenix_html, "~> 2.13.3"},
{:phoenix_ecto, "~> 4.0.0"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:gettext, "~> 0.11"},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},
{:plug, "~> 1.8.3"},
{:stripity_stripe, "~> 2.4.0"},
{:trumpet, in_umbrella: true},
{:swoosh, "~> 0.23.3"},
{:gen_smtp, "~> 0.13"},
{:phoenix_swoosh, "~> 0.2.0"},
{:pow, "~> 1.0.11"}
]
end
# config.exs:
config :trumpet_web, :pow,
user: Trumpet.User,
repo: Trumpet.Repo,
mailer_backend: TrumpetWeb.PowMailer
# dev.exs:
config :trumpet_web,
TrumpetWeb.PowMailer,
adapter: Swoosh.Adapters.Sendgrid,
api_key: "SG.X.X"
Please let me know if this isn’t the right place to ask this question. It seems like it might be an issue specific to the computers I’m using, but just want some other opinions.