Skip to content

Feature: Expand email builder API to support Content-Description on attachments #404

@CrisVnait

Description

@CrisVnait

Hello,

I want to send an email with an attachment. The attachment should contain as meta information a Content-Description. But my Content-Description header is ignored:

MimeMessage: Date: Wed, 13 Jul 2022 12:40:46 +0200 (CEST)
From: xxxx
Reply-To: xxxx
To: "xxxx"

Message-ID: 747447859.1.1657708846687@xxxxx
Subject: TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_0_1827369718.1657708846523"
X-KIM-Dienstkennung: eAU;Lieferung;V1.0
Disposition-Notification-To: xxxxxx
Return-Receipt-To: xxxxxx

------=_Part_0_1827369718.1657708846523
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

eAU
------=_Part_0_1827369718.1657708846523
Content-Type: application/octet-stream; filename=TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s;
name=TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename=TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s
Content-ID: <TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s>

Here at the end for 'eAU'-section the 'Content-Description'-element should be added.

My code:

List<AttachmentResource> attachmentResources = new ArrayList<>();

InternetHeaders headers = new InternetHeaders();
        headers.addHeader("Content-Description", storno ? "eAUStorno" : "eAU");
        headers.addHeader("Content-Type", MediaType.APPLICATION_OCTET_STREAM_VALUE);

MimeBodyPart mimeBodyPart = new MimeBodyPart(headers, xml, xml.length);

attachmentResources.add(new AttachmentResource(generateFilename(uuid, storno), mimeBodyPart.getDataHandler().getDataSource()));

Email email = EmailBuilder.startingBlank()
                    .withHeader(KimHeader.getDienstKennungHeaderName(), kimDienst.getEmailDienstKennungHeader())
                    .withReturnReceiptTo(from)
                    .withDispositionNotificationTo(from)
                    .withAttachments(attachmentResources)
                    .from(from)
                    .to(toName, toAdress)
                    .withSubject(subject)
                    .withPlainText(emailTextInhalt)
                    .buildEmail();

mailer.sendMail(email);

The 'Content-Type'-header is being processed, but the 'Content-Description' is ignored.
Version is 6.7.6

Any ideas how to solve my problem?
Thanks a lot for help!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions