Fixes: #9546
Issue link: https://github.com/spring-projects/spring-integration/pull/9546
Sometimes the IMAP connection breaks just after the message flags have been set, but the message has not been copied yet.
This then leads to the message never being received by (as it has been flagged and the next search will not return it).
* Flag and maybe delete messages after messages have been copied
# Conflicts:
# spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java
# Conflicts:
# spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java