From 85b588b51f45784cc3a7f012ecaa4b7c1f6aea14 Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Thu, 16 Nov 2023 13:31:12 -0500 Subject: [PATCH] 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. --- core/src/main/java/google/registry/groups/GmailClient.java | 1 + core/src/test/java/google/registry/groups/GmailClientTest.java | 1 + 2 files changed, 2 insertions(+) diff --git a/core/src/main/java/google/registry/groups/GmailClient.java b/core/src/main/java/google/registry/groups/GmailClient.java index 569456784..be649570b 100644 --- a/core/src/main/java/google/registry/groups/GmailClient.java +++ b/core/src/main/java/google/registry/groups/GmailClient.java @@ -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)); diff --git a/core/src/test/java/google/registry/groups/GmailClientTest.java b/core/src/test/java/google/registry/groups/GmailClientTest.java index ea720ff37..1014602cd 100644 --- a/core/src/test/java/google/registry/groups/GmailClientTest.java +++ b/core/src/test/java/google/registry/groups/GmailClientTest.java @@ -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