Mail is not getting sent using Swoosh Mailgun adapter in production

I am using Swoosh with Mailgun adapter to send email and Pow for user authentication.
When I run my project locally I get confirmation as well as reset password email through mailgun.

But when in Production, email is not getting sent.

Here is my config file

config :abc_app, :pow,
       user: AbcApp.Users.User,
       repo: AbcApp.Repo

config :abc_app, :pow,
       user: AbcApp.Users.User,
       web_module: AbcbAppWeb,
       extensions: [PowEmailConfirmation,PowPersistentSession, PowResetPassword ],
       controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks,
       mailer_backend: AbcAppWeb.Pow.Mailer,
       routes_backend: AbcAppWeb.Pow.Routes

config :abc_app, AbcAppWeb.Pow.Mailer,
       adapter: Swoosh.Adapters.Mailgun,
       api_key: "adcxxxx-xxxc-xxx",
       domain: ""

Can anyone please help me with this?

Are your API key correct in production? Also some mail providers (I use spark mail) require that you verify your domain.

Should we add the mail configuration in prod.exs file?

It depends. At least make sure its loaded in and are correct.

Sure … Will try by adding those.
Thank you.

Also, as I mentioned, make sure that Mailgun doesn’t have some sort of domain verification. They might allow localhost but not your production domain unless you verify it.

1 Like

In case you’re using an EU sending domain:

1 Like