stefannovak

stefannovak

Hi,

Likely a noob issue, apologies! I’ve been trying to migrate from a simple SendGrid Swoosh adaptor to an SMTP one, as I’ve switched over to Zoho mail. I can’t get an email to fire, but I can get it to work using a simple Python script, so I know the account setup and auth stuff is fine, I just can’t get Phoenix working with me. I’m deep in the rabbit hole of trying things I’m finding through AI or this forum and GitHub, without knowing what I’m really doing (never configured SMTP before)

I continue to get the following error, I’m using the register account email generated by phx auth.

{:error, {:retries_exceeded, {:temporary_failure, ~c"185.230.214.164", :tls_failed}}}

I’ve got this in my dev.exs

config :swoosh, :api_client, false

config :embernotes, Embernotes.Mailer,
  adapter: Swoosh.Adapters.SMTP,
  relay: "smtp.zoho.eu",
  username: "username",
  password: "password",
  port: 587,
  ssl: false,
  tls: :always,
  auth: :always,
  tls_options: [
    verify: :verify_peer,
    versions: ["tlsv1.3"],
    cacerts: :public_key.cacerts_get(),
    depth: 99
  ]

Those tls options are things I’ve found online. Even without them I get the same issue. I hope releasing to Prod isn’t much more difficult than getting this done on dev :sweat_smile:

From the Zoho docs

SMTP Configuration settings for Zoho Mail - TLS
Outgoing Server Settings: (Personal users with an email address as username@zohomail.com and and Free Organization users):

Outgoing Server Name: smtp.zoho.eu
Port: 587
Security Type: TLS 

Require Authentication: Yes. The email address should match the email address/ email aliases of the account, for which the authentication details are provided. 

Any help or direction is appreciated. Thanks!

Showing Posts 1 to 10

ruslandoga

ruslandoga

:wave: @stefannovak

Do you get any warnings from Erlang before this :retries_exceeded error?

LostKobrakai

LostKobrakai

https://github.com/gen-smtp/gen_smtp/issues/298#issuecomment-1405328435

The options don‘t do well separating starttls from fully tls connections.

ruslandoga

ruslandoga

But Zoho seems to be “normal” STARTTLS

# doesn't work
$ openssl s_client -connect smtp.zoho.eu:587

# works
$ openssl s_client -starttls smtp -crlf -connect smtp.zoho.eu:587

So I would try this config:

config :embernotes, Embernotes.Mailer,
  adapter: Swoosh.Adapters.SMTP,
  relay: "smtp.zoho.eu",
  username: "username",
  password: "password",
  port: 587,
  ssl: false,
  tls: :always,
  auth: :always,
  tls_options: [
    versions: [:"tlsv1.3"],
    verify: :verify_peer,
    cacerts: :public_key.cacerts_get(),
    server_name_indication: ~c"smtp.zoho.eu", # this is new
    customize_hostname_check: [ # and this is new
      match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
    ],
    depth: 99
  ]

And if it doesn’t work, maybe middlebox_comp_mode: false could be added:

config :embernotes, Embernotes.Mailer,
  adapter: Swoosh.Adapters.SMTP,
  relay: "smtp.zoho.eu",
  username: "username",
  password: "password",
  port: 587,
  ssl: false,
  tls: :always,
  auth: :always,
  tls_options: [
    versions: [:"tlsv1.3"],
    verify: :verify_peer,
    cacerts: :public_key.cacerts_get(),
    server_name_indication: ~c"smtp.zoho.eu",
    customize_hostname_check: [
      match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
    ],
    middlebox_comp_mode: false, # this is new
    depth: 99
  ]

EDIT: added customize_hostname_check

LostKobrakai

LostKobrakai

Yeah, providers do just as badly in differenciating it seems.

stefannovak

stefannovak OP

Hey guys thanks for the responses!

No Erlang error before this error, it’s just a GenServer crashing when it occurs after trying to send an email.

[error] GenServer #PID<0.1442.0> terminating
** (MatchError) no match of right hand side value: {:error, {:retries_exceeded, {:missing_requirement, ~c"185.230.214.164", :auth}}}```

EDIT: Wrong result pasted, it was the same error as in the original post.

Adding those two tls_options, server_name_indication and middlebox_comp_mode still result in the same error.

If it’s any interest, the Python setup for SMTP looked like this

# SMTP Config
smtp_server = "smtp.zoho.eu"
smtp_port = 587
smtp_user = "username"
smtp_password = "password"

try:
    with smtplib.SMTP(smtp_server, smtp_port) as server:
        server.starttls()
        server.login(smtp_user, smtp_password)
        server.send_message(msg)
        print("✅ Email sent successfully!")
except Exception as e:
    print(f"❌ Failed to send email: {e}")

I wrote that after failing to get an elixir script going, just wanted to see if any other language/framework could get it working, which made me believe it’s a Phoenix specific issue.

ruslandoga

ruslandoga

I wonder if you could try Mua adapter, in the very least it would show the actual error message: Swoosh.Adapters.Mua — Swoosh v1.26.2 (note the extra deps)

config :embernotes, Embernotes.Mailer,
  adapter: Swoosh.Adapters.Mua
  relay: "smtp.zoho.eu",
  auth: [username: "username", password: "password"],
  port: 587
D4no0

D4no0

Highly unlikely, most probably the option for authentication you are trying to use is invalid or unsupported by the server. If python allows it, have it run in debug mode so it shows the full logs that happen when talking with the server.

ruslandoga

ruslandoga

Oh, actually the new error is different, so one of the tls_options worked :slight_smile:

The error now is {:missing_requirement, ~c"185.230.214.164", :auth} and before it was {:temporary_failure, ~c"185.230.214.164", :tls_failed}, so now it’s about :username and :password options.

stefannovak

stefannovak OP

Mua worked!

But WHY haha

stefannovak

stefannovak OP

Sorry, i didn’t mean Phoenix itself, just my configuration with it

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews