In the Dynamics CRM sdk C#, is there any ways to create email with an embedded image inside the email body?
Asked
Active
Viewed 560 times
0
-
Does this blog help? https://www.emailarchitect.net/easendmail/kb/csharp.aspx?cat=8 – jasonscript Nov 22 '16 at 05:55
1 Answers
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