Skip to content

fix: add support for STARTTLS#219

Merged
andrinoff merged 1 commit intomasterfrom
fix/add-insecure-tls
Feb 27, 2026
Merged

fix: add support for STARTTLS#219
andrinoff merged 1 commit intomasterfrom
fix/add-insecure-tls

Conversation

@andrinoff
Copy link
Copy Markdown
Member

@andrinoff andrinoff commented Feb 27, 2026

Fixes #217

Add STARTTLS and InsecureSkipVerify support for local proxies

Changes:

  1. config/config.go

    • Added an Insecure boolean flag to the Account and rawAccount structs.

    • Updated LoadConfig JSON unmarshaling to parse and map the "insecure" field from the configuration file.

  2. fetcher/fetcher.go

    • Modified the connect() function to check the configured IMAP port.

    • Added fallback to establish a standard TCP connection (client.Dial) and upgrade it via StartTLS when standard unencrypted ports (1143, 143) are used, rather than forcing implicit TLS (client.DialTLS).

    • Injected tls.Config{InsecureSkipVerify: account.Insecure} into both connection methods to bypass strict certificate validation when the flag is enabled.

  3. sender/sender.go

    • Replaced the use of smtp.SendMail with a manually unrolled SMTP transaction (Dial, Hello, StartTLS, Auth, Data, Quit).

This allows the injection of a custom tls.Config with InsecureSkipVerify during the STARTTLS phase, which is not supported by the default smtp.SendMail implementation.

Signed-off-by: drew <me@andrinoff.com>
@github-actions github-actions Bot added the bug Something isn't working label Feb 27, 2026
@andrinoff andrinoff merged commit 91a8dd8 into master Feb 27, 2026
4 checks passed
@andrinoff andrinoff deleted the fix/add-insecure-tls branch February 27, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Unable to use ProtonMail (Proton Bridge) due to TLS error

1 participant