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

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

Closed
rkurman opened this issue Nov 23, 2023 · 4 comments

Comments

@rkurman
Copy link

rkurman commented Nov 23, 2023

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.

@bbottema
Copy link
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.

@rkurman
Copy link
Author

rkurman commented Nov 23, 2023

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.

bbottema added a commit that referenced this issue Nov 26, 2023
…h identical names don't refer to the same content
@bbottema bbottema 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 Nov 26, 2023
@bbottema bbottema 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 Nov 26, 2023
@bbottema bbottema added this to the 8.3.2 milestone Nov 26, 2023
@bbottema
Copy link
Owner

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

@rkurman
Copy link
Author

rkurman commented Feb 2, 2024

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
Projects
None yet
Development

No branches or pull requests

2 participants