Skip to content

SMTPS connections are incorrectly rejected when using a SOCKS proxy #687

Closed

Description

@bbottema

Summary

Simple Java Mail rejects every builder-managed SOCKS proxy combined with TransportStrategy.SMTPS:

if (transportStrategy == TransportStrategy.SMTPS) {
    throw new MailerException(MailerException.INVALID_PROXY_SLL_COMBINATION);
}

The exception says this is a limitation of the underlying mail framework. That no longer matches Angus Mail's documented properties or socket implementation.

Technical evidence

Lineage

The restriction first appears in commit 322ff855 from June 2016 and first shipped in 4.1.1. It converted an earlier warning that JavaMail ignored proxy settings for SSL connections into a hard failure. The supporting assumption has remained in ProxyConfig Javadoc ever since.

Documentation defect

The Spring production-profile example combines SMTPS with proxy credentials but omits the proxy host and port. Because ProxyConfig.requiresProxy() depends on a host, that example never activates proxying.

Expected behavior

  • Anonymous SOCKS proxying works with TransportStrategy.SMTPS.
  • Authenticated SOCKS proxying routes the SMTPS connection through Simple Java Mail's local authentication bridge.
  • SMTPS certificate and hostname verification behavior remains unchanged.
  • The obsolete exception and Javadoc restriction are removed.
  • Website examples contain a complete, valid proxy configuration.

Acceptance criteria

  • A local integration test proves an SMTPS connection reaches the TLS-enabled SMTP endpoint through SOCKS.
  • Authenticated proxy routing is covered if practical with the existing bridge test infrastructure.
  • Existing SMTP and STARTTLS proxy behavior remains unchanged.
  • The Spring profile and proxy documentation are corrected.

Activity

  1. added this to the v9.1.8 milestone on Aug 6, 2026
  2. self-assigned this
    on Aug 6, 2026
  3. bbottema commented on Aug 6, 2026

    @bbottema
    OwnerAuthor

    Implemented in 908d887. The obsolete SMTPS/proxy guard has been removed and the API guidance corrected. The corresponding website configuration and capability guidance is updated in simple-java-mail/simplejavamail.org@56810b3. This restores SOCKS routing for SMTPS while leaving SMTP and STARTTLS behavior unchanged.

  4. modified the milestones: v9.1.8, 9.2.0 on Aug 8, 2026
  5. bbottema commented on Aug 8, 2026

    @bbottema
    OwnerAuthor

    Available in Simple Java Mail 9.1.8. SOCKS routing now supports SMTPS while retaining the normal implicit-TLS certificate and hostname checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions