tolgagul opened a new pull request, #6385:
URL: https://github.com/apache/jmeter/pull/6385

   ## Description
   This update addresses an issue in the Mail Reader Sampler where the default 
behavior retrieves the oldest emails instead of the most recent ones. The fix 
modifies the getMessages method to correctly fetch the last n messages from the 
mailbox.
   
   Adjusted the indices in the folder.getMessages() call to dynamically 
calculate the range for the most recent messages.
   Added error handling for cases where n exceeds the total number of messages.
   
   ## Motivation and Context
   This change is required to resolve a common issue with the Mail Reader 
Sampler, where users typically need the most recent emails rather than the 
oldest ones. By implementing this fix:
   - Users can retrieve the latest n emails directly.
   - Aligns the sampler's behavior with user expectations and IMAP usage 
patterns.
   This PR addresses Issue #6384
   
   ## How Has This Been Tested?
   
   1. Test Scenarios:
   
   - Mailbox with fewer than n emails: Verified that all available emails are 
fetched.
   - Mailbox with more than n emails: Confirmed that only the last n messages 
are retrieved.
   - Boundary conditions: Tested with n=1, n=total_message_count, and 
n=total_message_count + 1.
   
   2. Environment:
   
   - Tested on a Gmail IMAP mailbox and a local test IMAP server.
   - Verified compatibility with both SSL and non-SSL connections.
   
   3. Results:
   
   - All test cases passed successfully.
   - No observed regressions in functionality.
   
   ## Types of changes
   - Bug fix (non-breaking change which fixes an issue)
   
   
   ## Checklist:
   - [X] My code follows the [code style][style-guide] of this project.
   - [X] I have updated the documentation accordingly.
   
   [style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to