Skip to content

AbstractMailReceiver.receive returns MimeMessage with outdated flags #9633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
artembilan opened this issue Nov 6, 2024 Discussed in #9632 · 0 comments
Closed

AbstractMailReceiver.receive returns MimeMessage with outdated flags #9633

artembilan opened this issue Nov 6, 2024 Discussed in #9632 · 0 comments

Comments

@artembilan
Copy link
Member

Discussed in #9632

Originally posted by dru1 November 6, 2024
Hi,

it looks like after merging PR#9546 the returned values from AbstractMailReceiver#receive no longer reflect the current state of the MimeMessage after the receiving process.

The message flags of the received messages are outdated and don't contain the changes of AbstractMailReceiver#setMessageFlags, because the flags are only applied to the original message and not the copy (AbstractMailReceiver.IntegrationMimeMessage).

The behavior change can be verified by debugging the returned values from receiver.receive() in the new unit test method. The flags are empty in the debugger, while the original messages (msg1, msg2) contain the flags \Seen and spring-integration-mail-adapter.

Was this change in behavior intentional? This looks like a bug to me, because message processing after the initial receiving step now works with an outdated state.

Best regards,
Daniel

@artembilan artembilan added this to the 6.4.0 milestone Nov 6, 2024
spring-builds pushed a commit that referenced this issue Nov 6, 2024
Fixes: #9633
Issue link: #9633

The message flags of the received messages are outdated and don't contain the changes of `AbstractMailReceiver#setMessageFlags`,
because the flags are only applied to the original message and not the copy (`AbstractMailReceiver.IntegrationMimeMessage`).

* Call `setMessageFlagsAndMaybeDeleteMessages()` for `IntegrationMimeMessage` copies as well

(cherry picked from commit 1d85d6b)
spring-builds pushed a commit that referenced this issue Nov 6, 2024
Fixes: #9633
Issue link: #9633

The message flags of the received messages are outdated and don't contain the changes of `AbstractMailReceiver#setMessageFlags`,
because the flags are only applied to the original message and not the copy (`AbstractMailReceiver.IntegrationMimeMessage`).

* Call `setMessageFlagsAndMaybeDeleteMessages()` for `IntegrationMimeMessage` copies as well

(cherry picked from commit 1d85d6b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants