Add a disposition header to email attachments (#2223)

This may help with the billing-team with attached invoices.

This is a standard header that should do no harm.
This commit is contained in:
Weimin Yu 2023-11-16 13:31:12 -05:00 committed by GitHub
parent 572b7101cb
commit 85b588b51f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -138,6 +138,7 @@ public final class GmailClient {
BodyPart attachmentPart = new MimeBodyPart();
attachmentPart.setContent(attachment.content(), attachment.contentType().toString());
attachmentPart.setFileName(attachment.filename());
attachmentPart.setDisposition(MimeBodyPart.ATTACHMENT);
multipart.addBodyPart(attachmentPart);
}
msg.addRecipients(RecipientType.BCC, toArray(emailMessage.bccs(), Address.class));

View file

@ -138,6 +138,7 @@ public class GmailClientTest {
assertThat(attachment.getContentType()).startsWith(CSV_UTF_8.toString());
assertThat(attachment.getContentType()).endsWith("name=filename");
assertThat(attachment.getContent()).isEqualTo("foo,bar\nbaz,qux");
assertThat(attachment.getDisposition()).isEqualTo("attachment");
}
@Test