mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 19:48:32 +02: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:
parent
572b7101cb
commit
85b588b51f
2 changed files with 2 additions and 0 deletions
|
@ -138,6 +138,7 @@ public final class GmailClient {
|
||||||
BodyPart attachmentPart = new MimeBodyPart();
|
BodyPart attachmentPart = new MimeBodyPart();
|
||||||
attachmentPart.setContent(attachment.content(), attachment.contentType().toString());
|
attachmentPart.setContent(attachment.content(), attachment.contentType().toString());
|
||||||
attachmentPart.setFileName(attachment.filename());
|
attachmentPart.setFileName(attachment.filename());
|
||||||
|
attachmentPart.setDisposition(MimeBodyPart.ATTACHMENT);
|
||||||
multipart.addBodyPart(attachmentPart);
|
multipart.addBodyPart(attachmentPart);
|
||||||
}
|
}
|
||||||
msg.addRecipients(RecipientType.BCC, toArray(emailMessage.bccs(), Address.class));
|
msg.addRecipients(RecipientType.BCC, toArray(emailMessage.bccs(), Address.class));
|
||||||
|
|
|
@ -138,6 +138,7 @@ public class GmailClientTest {
|
||||||
assertThat(attachment.getContentType()).startsWith(CSV_UTF_8.toString());
|
assertThat(attachment.getContentType()).startsWith(CSV_UTF_8.toString());
|
||||||
assertThat(attachment.getContentType()).endsWith("name=filename");
|
assertThat(attachment.getContentType()).endsWith("name=filename");
|
||||||
assertThat(attachment.getContent()).isEqualTo("foo,bar\nbaz,qux");
|
assertThat(attachment.getContent()).isEqualTo("foo,bar\nbaz,qux");
|
||||||
|
assertThat(attachment.getDisposition()).isEqualTo("attachment");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue