Skip to content

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

Closed

Description

@brian-tsb

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?

Activity

  1. bbottema commented on Mar 14, 2024

    @bbottema
    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?

  2. added this to the 8.6.4 milestone on Mar 14, 2024
  3. brian-tsb commented on Mar 14, 2024

    @brian-tsb
    Author
  4. added a commit that references this issue on Mar 20, 2024
  5. modified the milestones: 8.6.4, 8.7.0 on Mar 20, 2024
  6. bbottema commented on Mar 20, 2024

    @bbottema
    Owner

    Released in 8.7.1, can you please verify?

  7. brian-tsb commented on Mar 20, 2024

    @brian-tsb
    Author
  8. added a commit that references this issue on Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions