web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    Community member Profile Picture
    2 on at
    Embed attached image in email body html via CID
    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
    }
     
  • Genato Profile Picture
    56 on at
    RE: Embed attached image in email body html via CID

    Hello,

    @Mihir Kadam have you find any solution to this?

    Thank you.

  • Mihir Maruti Kadam Profile Picture
    702 on at
    RE: Embed attached image in email body html via CID

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

  • Kate_T Profile Picture
    185 on at
    RE: Embed attached image in email body html via CID

    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.

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at
    RE: Embed attached image in email body html via CID

    Hi Kate,

    Please refer the link below:

    https://social.microsoft.com/Forums/en-US/b35caf40-dd8a-4f13-855d-71d9884f05aa/30-embed-images-in-crm-email?forum=crm

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans