question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EHLO keyword contains invalid character

See original GitHub issue

Checklist

  • I have used the search function to see if someone else has already submitted the same bug report.
  • I will describe the problem with as much detail as possible.

App version

d13352a4cd7f5ea540eba738155ff377ee48da62 - 2205202769770bc37feb98414bb8a1ae084b9c98

Where did you get the app from?

Other

Android version

11 (LineageOS for microG)

Device model

Fairphone 3

Steps to reproduce

  1. Set up an email account
  2. Go to outgoing server settings
  3. Fill in everything and click next

SMTP server: <REDACTED> Security: SSL/TLS Port: 465 Require sign-in: Yes Username: <REDACTED> Authentication: Normal password Password: <REDACTED> Client certificate: No client certificate

Note: This happens on my own self-hosted mailserver, not on a public provider. I obviously don’t want to make authentication info for it public, but if it helps to debug please send me an email and I’ll get you some login credentials.

Expected behavior

Succesfully set up SMTP, like it did on K-9 Mail v6.000

Actual behavior

An error message shows:

Setup could not finish

Cannot connect to server. (EHLO keyword contains invalid character) [ Continue ] [ Edit Details ]

image

Logs

Using git bisect, I was able to pinpoint it to the following commit:

d13352a4cd7f5ea540eba738155ff377ee48da62 is the first bad commit
commit d13352a4cd7f5ea540eba738155ff377ee48da62
Author: cketti <cketti@gmail.com>
Date:   Wed Mar 23 04:07:37 2022 +0100

    Use new `SmtpResponseParser` in `SmtpTransport`

 .../smtp/EnhancedNegativeSmtpReplyException.java   |  12 +-
 .../fsck/k9/mail/transport/smtp/SmtpResponse.kt    |   3 +
 .../fsck/k9/mail/transport/smtp/SmtpTransport.java | 268 +++++++--------------
 .../k9/mail/transport/smtp/StatusCodeClass.java    |  12 -
 .../k9/mail/transport/smtp/StatusCodeDetail.java   |  80 ------
 .../k9/mail/transport/smtp/StatusCodeSubject.java  |  31 ---
 .../k9/mail/transport/smtp/SmtpTransportTest.java  |   8 +-
 7 files changed, 100 insertions(+), 314 deletions(-)
 delete mode 100644 mail/protocols/smtp/src/main/java/com/fsck/k9/mail/transport/smtp/StatusCodeDetail.java
 delete mode 100644 mail/protocols/smtp/src/main/java/com/fsck/k9/mail/transport/smtp/StatusCodeSubject.java

Please note: In the attached log file, I replaced the mailserver identification with mail.example.com and the Hello’s hostname and IP with <REDACTED>.

k9-log-redacted.txt

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cketticommented, May 15, 2022

With that option enabled Postfix seems to add a syntactically invalid keyword (starting with AUTH=):

https://github.com/vdukhovni/postfix/blob/abf156923c91c8c4f2bbd1a591114eb45bb77e81/postfix/src/smtpd/smtpd.c#L1952-L1953

1reaction
cketticommented, May 10, 2022

The server’s response to the EHLO command starts with:

250-mail.example.com Hello <REDACTED> [<REDACTED>]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-PIPE_CONNECT

PIPE_CONNECT contains an underscore, which is not allowed. See https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.1

It looks like this is a known issue that hasn’t received much attention: https://www.mail-archive.com/exim-users@exim.org/msg56497.html

I’d prefer for this to be fixed in exim rather than working around the issue in K-9 Mail. When I rewrote the SMTP response parser, I made it throw an error rather than ignore protocol violations to uncover cases like this – so that the code can be fixed.

Unfortunately, it will be a while before I have time to work on trying to get the issue fixed in exim. Given that this involves changing the keyword PIPE_CONNECT to something else, maybe you could get the ball rolling by starting a discussion with the exim developers. If not a lot of people are using the extension, a name change could be relatively simple. If the extension has a significant number of users, a migration strategy might be required.

Read more comments on GitHub >

github_iconTop Results From Across the Web

EHLO keyword contains invalid character · Issue #6062 ... - GitHub
I have used the search function to see if someone else has already submitted the same bug report. I will describe the problem...
Read more >
What does the classification “Cc contains invalid characters ...
When a message is rejected with "550 Subject contains invalid characters" the email subject will have non-ASCII characters, which is not allowed ...
Read more >
dovecot warns (non-fatal) "invalid EHLO response line
dovecot warns (non-fatal) "invalid EHLO response line: Unexpected character in EHLO keyword" connecting to submission relay ?
Read more >
The message contains invalid characters. - Apple Developer
Help, I'm trying to post a legitimate question but I keep getting this error that says "The message contains invalid characters." I tried...
Read more >
This message has been blocked because the HELO/EHLO ...
This message has been blocked because the HELO/EHLO domain is invalid. Go to solution.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found