Incorrect AUTH PLAIN string

Description

Authentication failed when connecting to SMTP server. When I look to log file, I see that incorrect Auth string is send.

----------SMTP----------
connect mail.egate.cz 587
220 eGate SMTP
init
EHLO matla-ntb
250-mail.egate.cz
250-SIZE 102400000
250-STARTTLS
250-AUTH LOGIN PLAIN
250 HELP
start TLS
STARTTLS
220 Ready to start TLS
done
OpenSSL version: OpenSSL 1.1.0f  25 May 2017
init after starttls
EHLO matla-ntb
250-mail.egate.cz
250-SIZE 102400000
250-AUTH LOGIN PLAIN
250 HELP
AUTH PLAIN YWRhbS5tYXRsQGRlc28uY3oAYWRhbS5tYXRsQGRlc28uY3oAY2Vuc29yZWQ=
535 Authentication failed. Restarting authentication process.


SASL_PATH: /usr/share/mailspring/resources/app.asar.unpacked

SMTP Last Response Code: 535
SMTP Last Response: Authentication failed. Restarting authentication process.


mailsmtp Last Error Code: 17
mailsmtp Last Error Explanation: MAILSMTP_ERROR_AUTH_LOGIN
mailsmtp Last Error Location: 10
mailsmtp Last Auth Type: 2

Decoded AUTH PLAIN string

adam.matl@deso.cz\0adam.matl@deso.cz\0censored

there is username two times

When I try to connect with OpenSSL and correct auth string, it is OK.

openssl s_client -crlf -connect mail.egate.cz:465
...
read R BLOCK
220 eGate SMTP
EHLO mail.egate.cz
250-mail.egate.cz
250-SIZE 102400000
250-AUTH LOGIN PLAIN
250 HELP
AUTH PLAIN AGFkYW0ubWF0bEBkZXNvLmN6AGNlbnNvcmVk
235 authenticated.

To Reproduce…

Steps to reproduce the behavior:

  1. File->Add new account
  2. IMAP/SMTL
    Fill credentials

    click continue
    fill settings
    click connect account
    result

Expected Behavior

Connection to account

  • OS and Version: Ubuntu 21.04
  • Installation Method: .deb
  • Mailspring Version: 1.9.2-6e14dad1