Skip to content

SMTP authentication fails on servers supporting only LOGIN (attempts PLAIN first and drops connection) #355

Description

@DerKempter

Operating System

Linux

Architecture

x86_64

Linux Distro

Tuxedo OS

Linux Distro Version

Ubuntu 24.04 LTS

Is webkit2gtk 4.1 installed?

Yes

Install Method

Linux Binary

Aerion Version

0.3.2

Description

When connecting to an SMTP server that advertises 250-AUTH GSSAPI NTLM LOGIN (no PLAIN), Aerion attempts AUTH PLAIN anyway. The server rejects PLAIN, breaking/closing the connection state. Aerion's subsequent attempt to fall back to LOGIN fails due to use of closed network connection.

Relevant log snippet:

DBG ... > Connecting to SMTP server component=smtp host=<my-mailserver> port=<my-port> security=starttls
DBG ... > Upgraded connection to TLS via STARTTLS component=smtp
INF ... > Connected to SMTP server component=smtp host=<my-mailserver>
DBG ... > Authenticating authType=password component=smtp username=<username>
DBG ... > Available auth mechanisms component=smtp mechanisms="GSSAPI NTLM LOGIN"
DBG ... > PLAIN auth failed, trying LOGIN component=smtp
DBG ... > Closing SMTP connection component=smtp
WRN ... > QUIT failed, closing anyway error="use of closed network connection" component=smtp

Steps to Reproduce

  1. Configure an SMTP outgoing account against a server that advertises only GSSAPI NTLM LOGIN under 250-AUTH capabilities (e.g., port 587, STARTTLS).
  2. Attempt to send an email using this account.
  3. Observe that sending fails instantly, and check the debug logs.

Expected Behavior

Aerion should inspect the EHLO capabilities advertised by the SMTP server prior to authentication. If PLAIN is not listed, it should directly select a supported mechanism like LOGIN.

If an authentication command fails and invalidates the session, Aerion should re-establish/reset the connection context rather than attempting secondary auth on a closed TCP socket.

Actual Behavior

Aerion unconditionally sends AUTH PLAIN first. The server rejects it and closes/invalidates the socket. Aerion then attempts to issue LOGIN on the closed socket, resulting in error="use of closed network connection".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions