Skip to content
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

Order of attachments is lost when converting a MimeMessage to an Email #497

Closed
timestudybuddy opened this issue Mar 13, 2024 · 4 comments
Closed

Comments

@timestudybuddy
Copy link

I'm writing a script that monitors an IMAP box, and clones bounce messages, adjusting the recipients so that they reach our customers' corresponding Administrators. I'm using simple-java-mail to convert an IMAPMessage/MimeMessage into an Email, which we can then feed into our existing mail subsystem. I've noticed that the order of attachments gets lost during this conversion. Bounce messages follow a specific standard, and the order of these attachments matters.

I traced it down to org.simplejavamail.converter.internal.mimemessage.ParsedMimeMessageComponents.attachmentList being a SortedSet. This effectively orders the attachments by their name. Is there a reason this isn't simply an ArrayList?

@bbottema
Copy link
Owner

Hmm, I'm not sure, but the decision was made in the early days of this project, presumably due to testing challenges where the attachments were out of order otherwise. However, I replaced it LinkedHashSet and everything tested fine still. Would that would for you?

@bbottema bbottema added this to the 8.6.4 milestone Mar 14, 2024
@timestudybuddy
Copy link
Author

timestudybuddy commented Mar 14, 2024 via email

@bbottema bbottema modified the milestones: 8.6.4, 8.7.0 Mar 20, 2024
@bbottema
Copy link
Owner

Released in 8.7.1, can you please verify?

@timestudybuddy
Copy link
Author

timestudybuddy commented Mar 20, 2024 via email

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