Issue in imap communication with Exchange server

we have an issue in communication with an Exchange server via IMAP. SSL handshake is successful, but after that we get: AE_2300_1_0001 NO AUTHENTICATE
What are the potential reasons for that error?

PS: we still are on version 22.12. But I just saw in the current release notes that you fixed an issue reported by us in 23.7. Thank you for fixing that so fast.

Hello @ugort,

Can you provide an example of the code you use to connect to Exchange via IMAP? Do you use modern authentication to connect to the server?

Thanks.

Hello @margarita.samodurova
we noticed that when the password contains non-ascii characters (e.g. ö, ä) we have this issue.

Does Aspose Email for Java support UTF8 encoding in IMAP communication?
How to enable it?

PS: Versions 23.8 and 22.12 behave the same.
PPS: RFC 5738: IMAP Support for UTF-8

Hello, thanks for the info. We’ll investigate this issue and give a feedback

Hello @dmitry.samodurov

thank you very much. Do you already have an update on this?
Some of our users are affected and are getting impatient with the need to change their passwords.
Especially it would be good to know if there is a workaround on our side that we could apply.

Hi @ugort
Your problem is under investigation. We apologize for the inconvenience.

@ugort
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILJAVA-35204

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@sergey.vivsiuk
Thank you for taking care of the issue. Please note that we are not sure if the mail servers we need to address support UTF8 capability or not. Greenmail (which we use for unit tests) for example does not. But still supports ö,ä when used together with Thunderbird.

@ugort
Thank you for info.

Hello @ugort,

We are working to resolve the issue. Could you provide an additional more detailed IMAP connection log?
You can use below code:

ImapClient client = new ImapClient()
client.setLogFileName("c:\\logs\\imap.log");

Hi @sergey.vivsiuk

On behalf of @ugort I’m providing the requested log file.

imap-log.7z (812 Bytes)

In this example we use Greenmail as the IMAP server and “username” as the username and “passwörd” as password.

When we observed the traffic with Wireshark we saw that Thunderbird sends the password ISO-8859-1 encoded while Aspose uses UTF-8. We did not find a way to tell Aspose to use ISO-8859-1 as well. Maybe that helps.

Cheers,
Florian

Hello @fhediger,

Thanks for the info. We are working on the issue.

Hello @fhediger,

Could you check the issue on your side using the 23.8.0.2 hotfix

ImapClient client = new ImapClient(..
client.setCredentialsEncoding("ISO-8859-1");
...

Hi @sergey.vivsiuk

Thank you for the hotfix. It indeed works with Greenmail. :+1: I yet have to test it with a Microsoft Exchange Server. I will come back to you asap.

Florian

Hello @fhediger,

Please share your feedback after testing.

Thanks.

Hi @margarita.samodurova

Sure! Currently I’m waiting for a test environment myself.

@fhediger,

Please inform us about the results.

And feel free to ask if you have any further questions.

Thank you.

Hi @margarita.samodurova, hi @sergey.vivsiuk

We tested your patch against Greenmail, Dovecot and Microsoft Exchange.

  • Greenmail works
  • Dovecot works
  • Microsoft Exchange does not work

I cannot provide an imap.log of the communication with the Exchange Server because it contains information not sharable with the public.

Don’t you have the possibility to test against an Exchange Server yourself?

Hi @fhediger,

Your imap.log file might be of great help. We can make this thread private for you to securely share the file with us for investigation. Besides, you can delete all the sensitive information from the file.

Please inform us about your decision.
Thanks.

Hi @margarita.samodurova, @sergey.vivsiuk

I did some further debugging and this is what I discovered:

  • The LOGIN command does not support unicode when using our MS Exchange Server
  • However, when I use AUTHENTICATE PLAIN it works

When using AUTHENTICATE PLAIN we also have to be able to set the credential encoding which is used on the username/password String before encoding it to base64.

You can create the correct base64 string in a console using unix tools like this:

echo -en "\0<username>\0<password in utf8>" | iconv -f utf8 -t iso8859-1 | openssl base64

With this credentials I was able to successfully login using AUTHENTICATE PLAIN.