Skip to content

fix: set NoStartTLS when disable_startttls=true#4516

Open
Flgado wants to merge 2 commits intoory:masterfrom
Flgado:fix/smtp-disable-startttls
Open

fix: set NoStartTLS when disable_startttls=true#4516
Flgado wants to merge 2 commits intoory:masterfrom
Flgado:fix/smtp-disable-startttls

Conversation

@Flgado
Copy link

@Flgado Flgado commented Dec 31, 2025

Problem

Users configuring SMTP with disable_starttls=true to force plaintext connections (common in development environments) experience connection failures with "unencrypted connection" errors, despite explicitly disabling StartTLS.

Root Cause

In smtp.go, when disable_starttls=true is set, the code correctly skips setting MandatoryStartTLS but fails to explicitly set NoStartTLS. This leaves the dialer with the default OpportunisticStartTLS policy, which still attempts TLS connections when the SMTP server advertises STARTTLS capability.

This can be confuse for users, because they explicite set the disable_starttls to true.

Solution

Explicitly set StartTLSPolicy = gomail.NoStartTLS when `disable_starttls=true to completely disable TLS negotiation attempts.

Related issue(s)

#4498

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@Flgado Flgado requested review from a team and aeneasr as code owners December 31, 2025 00:37
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Flgado Flgado changed the title Set NoStartTLS when disable_startttls=true fix: Set NoStartTLS when disable_startttls=true Dec 31, 2025
@Flgado Flgado changed the title fix: Set NoStartTLS when disable_startttls=true fix: set NoStartTLS when disable_startttls=true Dec 31, 2025
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.

2 participants