Exchange Online IMAP attachment download delay and failure only for a specific account

ktoa 20 Reputation points
2025-09-19T05:49:20.58+00:00

We are using a JavaMail-based application to retrieve emails from Exchange Online via IMAP. Since June 30, we have been facing an issue, but only for a specific account:

Attachments download normally when the mailbox has few messages

As the number of emails grows, attachment download becomes slower

Eventually, the application fails to retrieve the emails

The same application works fine with other accounts (no delay)

Example log:

[INFO ][2025/06/30 15:43:50.726] AttachSize : 10602462
[INFO ][2025/06/30 15:43:55.822] buffer size : 1048576
[INFO ][2025/06/30 15:43:58.292] buffer size : 2097152
[INFO ][2025/06/30 15:44:02.324] buffer size : 3145728
[INFO ][2025/06/30 15:44:04.603] buffer size : 4194304
[INFO ][2025/06/30 15:44:07.340] buffer size : 5242880
[INFO ][2025/06/30 15:44:13.099] buffer size : 6291456
[INFO ][2025/06/30 15:44:16.010] buffer size : 7340032
[INFO ][2025/06/30 15:44:18.509] buffer size : 7747951 [complete]

Attachments of the same size normally take about 3 seconds to download, but after the delay started, it takes about 30 seconds.

Outlook/OWA works fine, but IMAP (JavaMail) shows this delay and failure only for the specific account.

Could such account-specific behavior happen in Exchange Online IMAP? Any advice on what to check (server-side or client-side) would be appreciated.

Exchange Online
Exchange Online
A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Vergil-V 6,220 Reputation points Microsoft External Staff Moderator
    2025-09-19T08:53:19.6833333+00:00

    Hi @ktoa 
    Thank you for reaching out to Microsoft Learn Q&A!  
    Based on your description, I understand that your JavaMail application experiences slower performance when retrieving emails via IMAP from Exchange Online, especially as the mailbox size increases. 

    From my research, one possible explanation for this behavior is the throttling policy applied in Exchange Online. This policy is enforced per mailbox and is designed to manage resource consumption, prevent system overload, and ensure stable performance for all users and applications. 

    Server-side considerations: 
    To check the server side: In order to examine the throttling policy applied to IMAP in Exchange Online, you’ll need to contact Microsoft Support by opening a support ticket via the Microsoft Admin Center or by calling the Support Number. This is in line with the guidance provided in the referenced thread: is any option to change imap throttling policy? - Microsoft Q&A 

    Client-side suggestions: 
    To improve performance on the JavaMail side, you might consider adding the following properties to your application: 

    props.setProperty("mail.imaps.partialfetch","false");
    props.setProperty("mail.imaps.fetchsize", "1048576"); // or higher
    

    These settings can help optimize how messages are fetched, especially for larger mailboxes. 

    Reference: java - Setting the "mail.imaps.fetchsize" property to a large number using JavaMail have any impact… 

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.  

    If the issue persists after trying the above methods, could you kindly share any screenshots of the error codes or messages you're encountering? 

    It would help me better understand your situation. 

    Please know that while our initial response might not resolve the issue right away, your input is incredibly valuable. With a bit more detail, we’ll work together to find the best solution for you. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.   


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.