Skip to content

fix: send mail through a smarthost without login - #129

Merged
stephdl merged 7 commits into
mainfrom
fix-smtp-auth
Nov 20, 2026
Merged

stephdl merged 7 commits into
mainfrom
fix-smtp-auth

Conversation

@stephdl

@stephdl stephdl commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Synapse could not send any mail when the cluster smarthost has no username, which is the default when it points to the mail server of the cluster. Every mail failed with 502 Server does not support Client Authentication schemes. NethServer/dev#7648

The template rendered smtp_user: "" when no username was set. Synapse turns on SMTP authentication as soon as smtp_user is defined, even when it is empty. I now render smtp_user and smtp_pass as null without a username. With a username, both values stay quoted.

  • The templates are now filled in one pass. Before, a password holding ${SOME_KEY} of a later variable was expanded again and corrupted.
  • The settings tests set the smarthost themselves, check both cases, including a password with @, :, #, quotes and ${...}, then restore it and wait for Synapse.
  • The user directory test now waits for the Synapse background updates. They took more than two minutes on the CI machine, so the search returned nothing, on main too.

How to test

  • Set a smarthost without username, then add an email address in Element and check that Synapse sends the verification mail.
  • Set a smarthost with a username and a password holding reserved characters, and check that Synapse starts and homeserver.yaml keeps the values unchanged.

Without SMTP credentials the template rendered smtp_user as "". Synapse
requires authentication as soon as smtp_user is set, so every mail
failed with "Server does not support Client Authentication schemes".
smtp_user and smtp_pass are now null when no username is set.
@stephdl stephdl self-assigned this Nov 20, 2026
A value holding ${KEY} of a later variable, for example in a password,
was expanded again and corrupted.
The directory search returned nothing in the CI update scenario, even
after two minutes. Synapse fills the directory from a background update,
which can run longer on the slow test VM. On failure the test now lists
the pending updates.
@stephdl
stephdl marked this pull request as ready for review November 20, 2026 17:59
@stephdl
stephdl merged commit aac6790 into main Nov 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant