Search code examples
pythonazureazure-communication-services

How to define a Content Id on an attachment using azure-communication-email?


I am using the azure-communication-email library to send emails through the Azure service.

I need to add an image in base64 format as an attachment and define a Content Id to reference it in an <img src="cid:myimagecid"> tag.

The problem is that EmailAttachment only allows to define:

attachment = EmailAttachment(
    name="attachment.png",
    attachment_type="png",
    content_bytes_base64=file_bytes_b64
)

Is there any way to define that Content Id in the attachment?


Solution

  • There's no way as of yet (Sept 2022), but please keep an eye on this issue on GitHub.