0

In the Dynamics CRM sdk C#, is there any ways to create email with an embedded image inside the email body?

Alfred Lau
  • 21
  • 2

1 Answers1

0

I don't know of a CRM specific way to do it, but you can do it by embedding a base64 encoded image into the email. This can be done using something along the lines of:

var bytes = File.ReadAllBytes(@"C:\path\to\image.jpg");
var imageData = Convert.ToBase64String(bytes);
var email = new Email
{
    Subject = "See my picture",
    Description = $"Here it is: <img style='display:block; width:100px;height:100px;' id='base64image' src = 'data:image/jpeg;base64,{imageData}' /> "
};
MBL
  • 151
  • 4