In IMAP protocol enabled Mail fetching environments, we may face AuthenticationFailedException.
But after few minutes, mails will be fetched normally ( without any changes by the user ).
This is because, the opened IMAP connections from Application server to Exchange Server are not closed properly. Due to this, the maximum concurrent IMAP connections ( by default it is 16 connections per mailbox ) got exhausted and the above exception throws.
1. Try decreasing the Authenticated time-out and Unauthenticated time-out in the Exchange Admin Centre.
Go to Exchange Admin Centre ( /ecp ) >> Servers >> Select your server and double click >> Click IMAP4 >> Click More options >> Reduce the Authenticated and Unauthenticated time-out to 60s.
After this changed, restart your application server and monitor mail fetching. If this workaround doesn't help, please try option 2.
2. Try using EWS protocol in SDP for mail fetching.