电子邮件HTML文档,使用c#嵌入图像 [英] Email HTML document, embedding images using c#

查看:97
本文介绍了电子邮件HTML文档,使用c#嵌入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况。

我需要以HTML格式的字符串发送电子邮件,其中嵌入了图像。我试图将我的图像转换为base64,但它不起作用。

I need to send an email as a string in HTML format that has images embedded in it. I tried converting my images into base64 but it does not work.

电子邮件包含3个图像,类型为System.Drawing.Image。我只需要将它们放入我的html格式的字符串中。

The email has 3 images as type System.Drawing.Image. I just need to get them in my html formatted string.

推荐答案

转换为base64是正确的,但还不够嵌入它(客户端将无法区分base64到纯文本),您需要格式化一下。

You were right about converting to base64, but it is not enough to embed it (there would be no way for the client to distinguish base64 to plain text), you need to format it a bit.

检查Buhake的答案,它涵盖非常好的问题在一般情况下(你应该能够从中获得):
如何在电子邮件中嵌入图片

Check out Buhake's answer, it covers very well the problem in general (you should be able to take it from there): How to embed images in email

这篇关于电子邮件HTML文档,使用c#嵌入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆