Retrieving the Most Recent Emails in Mail Reader Sampler
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Description
### Expected behavior
The Mail Reader Sampler should retrieve the most recent n messages from the mailbox, regardless of the server's default ordering. Instead of fetching messages starting from the first received email, it should correctly fetch the last n messages by adjusting the indices in the getMessages method. This ensures that users can access the latest emails as needed.
### Actual behavior
The Mail Reader Sampler retrieves messages starting from the first received email by default. This behavior aligns with the typical IMAP server ordering, where messages are numbered sequentially from the earliest to the latest. As a result, the sampler fetches older messages instead of the most recent ones, which may not meet the intended requirement of retrieving the latest n messages.
### Steps to reproduce the problem
1. Configure the Mail Reader Sampler to connect to an IMAP mailbox.
2. Use the folder.getMessages(1, n) method to retrieve emails, specifying a value for n (e.g., n=5).
3. Ensure the mailbox contains more than n messages, with both old and new messages available.
4. Execute the sampler to fetch the emails.
5. Observe the retrieved messages and verify that they correspond to the oldest messages in the mailbox instead of the most recent ones.
### JMeter Version
5.6.3
### Java Version
openjdk version "21.0.1" 2023-10-17
### OS Version
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.