简体   繁体   English

Dynamics CRM SDK C#创建带有嵌入式图像的电子邮件

[英]Dynamics CRM sdk C# Create email with embedded image

在Dynamics CRM sdk C#中,是否有任何方法可以在电子邮件正文中创建带有嵌入式图像的电子邮件?

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. 我不知道特定于CRM的方式,但是可以通过将base64编码的图像嵌入到电子邮件中来实现。 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}' /> "
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM