web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Embed attached image in email body html via CID

(0) ShareShare
ReportReport
Posted on by 185
 

Hello.

Is it possible to embed an attached image to email body html via the <img> tag with src = "cid:<some content id>"?

My current solution is:

1) Get ActivityMimeAttachments with "image/..." mime type related to the email
2) Get the ContentId property of these attachments
3) Add corresponding <img> tags to email description:

<img src="cid:<contentid value here>" alt = "Some image"/>

After that I save this email and send it via CRM Email router.
Recieved emails contain correct attachments and <img> tags with CIDs, but images aren't displayed in all browsers and email clients. Just empty squares with alt text.

I've googled a solution and found the following KB article: https://support.microsoft.com/ru-ru/kb/2934043. Maybe, this is the source of my problem?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at
  • Kate_T Profile Picture
    185 on at

    Hello Nithya,

    I'm not sure that this post meets my requirements completely. Unless I'm mistaken, Adi's answer is related to incoming emails  (from external senders to CRM) and the image src like "/MicrosoftCRM/Activities/Attachment/...." is an internal CRM url.  My task is embedding images in outgoing emails (from CRM to external recievers). These recievers don't have access to a server where CRM is hosted.  

    Nevertheless I will try this solution.

    Thank you.

  • Mihir Maruti Kadam Profile Picture
    702 on at

    I have the same requirement. @kate_t Do have the solution ?

  • Genato Profile Picture
    56 on at

    Hello,

    @Mihir Kadam have you find any solution to this?

    Thank you.

  • Suggested answer
    Community member Profile Picture
    2 on at
    I am responding to anyone who is struggling with adding images to email body using nodemailer. I had an array of images and wanted to dynamically add them to my email body. I used a loop and then did this  attachments.push({filename:item.name, path:item.m_image, cid:`${item.id}`}), ( note: I declared attachments outside the array then pushed the images into it). For the img tag, I did this <img key=${item.id} src= `cid:${item.id}` /* I used backtips on src, not quotes */ /> and finally I added attachments like this 
    const mailConfig = {
    from: `my email`,
    to: "receiver email",
    subject: 'Order confirmation',
    html: mail,
    attachments: attachments
    }
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans