You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue:
When I set a custom Content-ID for attachments, it gets overwritten after building the email using EmailBuilder.buildEmail() and send it .
Steps to Reproduce
Create an email with an attachment using EmailBuilder.startingBlank().
Convert the email to MimeMessage and set a custom Content-ID for the attachment.
Convert it back to an Email using EmailConverter.mimeMessageToEmail(mimeMessage).
Send the email.
The Content-ID is changed after building the email and sending the email.
Expected Behavior
The custom Content-ID should stay the same after building the email and sending the email.
Actual Behavior
The Content-ID I set for the attachment gets overwritten after building the email and sending the email.
Example Code
Emailemail = EmailBuilder.startingBlank()
.from("[email protected]")
.to("[email protected]")
.withSubject("Test Content-ID")
.withAttachment("file.pdf", newFileDataSource("/path/to/file.pdf"))
.buildEmail();
// Convert to MimeMessageMimeMessagemimeMessage = EmailConverter.emailToMimeMessage(email);
MimeMultipartmultipart = (MimeMultipart) mimeMessage.getContent();
// Set the custom Content-IDfor (inti = 0; i < multipart.getCount(); i++) {
BodyPartpart = multipart.getBodyPart(i);
if ("file.pdf".equals(part.getFileName())) {
part.setHeader("Content-ID", "<custom-id-12345>");
}
}
mimeMessage.setContent(multipart);
mimeMessage.saveChanges();
// Convert back to EmailEmailupdatedEmail = EmailConverter.mimeMessageToEmail(mimeMessage);
Request
Prevent Overwriting: I need a way to keep the custom Content-ID I set for attachments. It should not be changed when build the email.
Direct Option (Optional): If possible, I would like to set the Content-ID directly on the attachment without converting to MimeMessage, from the AttachmentResource resource directly.
The text was updated successfully, but these errors were encountered:
Issue:
When I set a custom Content-ID for attachments, it gets overwritten after building the email using
EmailBuilder.buildEmail()
and send it .Steps to Reproduce
EmailBuilder.startingBlank()
.MimeMessage
and set a custom Content-ID for the attachment.Email
usingEmailConverter.mimeMessageToEmail(mimeMessage)
.Expected Behavior
The custom Content-ID should stay the same after building the email and sending the email.
Actual Behavior
The Content-ID I set for the attachment gets overwritten after building the email and sending the email.
Example Code
Request
The text was updated successfully, but these errors were encountered: