Skip to content

Bug: Multiple attachments with same name get the same Content-ID, causing them to refer to the same file content #480

Closed

Description

@rkurman

When I'm trying to send an email where multiple attachments with the same name, the receiver thinks that it is always the same attachment and shows the same content for all attached files.
I have tested this with versions 6.5.2 and 8.3.1.

In my opinion, the problem is the assignment of the BodyPart ID in org.simplejavamail.converter.internal.mimemessage.MimeMessageHelper.getBodyPartFromDatasource(AttachmentResource, String) (line 288) where the Content-ID header of the part is based solely on the filename of the attachment. I suggest to always add a UUID at the end to ensure uniqueness.

Activity

  1. bbottema commented on Nov 23, 2023

    @bbottema
    Owner

    Hmm, interesting. I'm not a fan of using UUID, that makes the filenames unwieldy, but a sequence number could work... I'll have a look.

  2. rkurman commented on Nov 23, 2023

    @rkurman
    Author

    Isn't the filename determined by the filename parameter of the Content-Type header? The Content-ID should not have any influence on the filename.

  3. added a commit that references this issue on Nov 26, 2023
  4. changed the title [-]Multiple attachments with same name get the same Content-ID[/-] [+]Multiple attachments with same name get the same Content-ID, causing them to refer to the same file content[/+] on Nov 26, 2023
  5. changed the title [-]Multiple attachments with same name get the same Content-ID, causing them to refer to the same file content[/-] [+]Bug: Multiple attachments with same name get the same Content-ID, causing them to refer to the same file content[/+] on Nov 26, 2023
  6. added this to the 8.3.2 milestone on Nov 26, 2023
  7. bbottema commented on Nov 26, 2023

    @bbottema
    Owner

    This should now be fixed in 8.3.2. Can you please verify, if you get a chance?

  8. rkurman commented on Feb 2, 2024

    @rkurman
    Author

    I can confirm that the problem is resolved now (I checked with version 8.6.2).
    Thank you very much, sir.

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