Skip to content

[Communication email] Allow setting attachment content disposition as inline  #25604

Closed

Description

When using the EmailClient from the recently published @azure/communication-email, we can attach files to the email using the following API:

{ name: string, contentType: string, contentInBase64: string }

While this woks for general attachments (like documents, etc), this interface is quite limited if we want to use the attachments to display images inside our email.

To be able to send emails while avoiding loading external images (which are blocked by default in most email clients), it is a common pattern these days to add an image as attachment and display it using its content ID (eg: <img src="cid:logo" alt="Company"/>)

Unfortunately for this to work reliably on the majority of email clients, the Content-Disposition header should be set as inline, instead of the now default attachment. (eg: Content-Disposition: inline; filename="logo.png"; size=16864;)

And the Content-Id also seems to be randomly generated by Azure (eg. Content-Id: <961cf742-4ea9-445e-96e4-58e256928715>), which makes it impossible to properly reference the image by its own ID from the email body template.

Would be really helpful to allow this properties/headers to be set when adding the attachment, by expanding the current API.

I didn't find any workaround for this, since it seems to not be possible to generate a raw email, and send it using the current client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Communication - EmailService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions