1
0
mirror of https://github.com/google/nomulus synced 2026-01-08 23:23:32 +00:00

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
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