analytics icon indicating copy to clipboard operation
analytics copied to clipboard

(Mua.SMTPError) 503 Bad sequence of commands

Open Kogs opened this issue 4 months ago • 2 comments

Past Issues Searched

  • [x] I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • [x] This is a bug report and not a feature request, nor asking for self-hosted support

Using official Plausible Cloud hosting or self-hosting?

Self-hosting

Describe the bug

It seems like the smtp client has problems connecting to the ionos smpt server.

19:23:21.873 [error] Failed to send e-mail:

   ** (Mua.SMTPError) 503 Bad sequence of commands

    (bamboo 2.3.0) lib/bamboo/mailer.ex:234: Bamboo.Mailer.deliver_now!/4
    (plausible 0.0.1) lib/plausible/mailer.ex:8: Plausible.Mailer.send/1
   (elixir 1.18.3) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
   (plausible 0.0.1) lib/plausible/teams/management/layout.ex:127: Plausible.Teams.Management.Layout.persist/2
    (plausible 0.0.1) lib/plausible_web/live/team_management.ex:287: PlausibleWeb.Live.TeamManagement.save_team_layout/1
     (plausible 0.0.1) lib/plausible_web/live/team_management.ex:207: PlausibleWeb.Live.TeamManagement.handle_event/3
     (phoenix_live_view 1.0.4) lib/phoenix_live_view/channel.ex:508: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
     (telemetry 1.3.0) /app/deps/telemetry/src/telemetry.erl:324: :telemetry.span/3

The Config:

Application.get_env :plausible, Plausible.Mailer

[
  adapter: Bamboo.Mua,
  ssl: [middlebox_comp_mode: false],
  protocol: :ssl,
  relay: "smtp.ionos.de",
  port: 465,
  auth: [username: "<redacted>", password: "<redacted>"]
]

The same connection settings do work in other software.

Running community edition: ghcr.io/plausible/community-edition:v3.0.1

Expected behavior

Should be able to connect to the smtp server.

Screenshots

No response

Environment

ghcr.io/plausible/community-edition:v3.0.1

Kogs avatar Aug 21 '25 19:08 Kogs

👋 @Kogs

Seems to be because Mua sends a second EHLO after STARTTLS attempt, but there is no STARTTLS on port 465 so it sends two in a row and smtp.ionos.de doesn't like it. This will need to be fixed in Mua: https://github.com/ruslandoga/mua/issues/76

Thank you for the report!

ruslandoga avatar Aug 22 '25 13:08 ruslandoga

@Kogs The fix for this will be available in v3.1.0. There's a release candidate out for that now https://github.com/plausible/analytics/releases/tag/v3.1.0-rc.1. Give it a whirl and let us know if that solves your issue.

apata avatar Nov 04 '25 15:11 apata