如何发送电子邮件包含图像而不将图像保存为文件? [英] How to send email contains an image without saving image as a file?

查看:108
本文介绍了如何发送电子邮件包含图像而不将图像保存为文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为标题。

我正在开发一个可以通过电子邮件向会员发送QR码图像的系统。我想在Web服务中构建它以使用许多客户端。我使用的当前方法是将QR码保存为真实的图像文件,并在发送电子邮件时附加它,但是当我在Web服务上使用它时失败。消息说GDI +上发生了一些错误。

我在谷歌搜索了一些关键词C#,电子邮件和图片。许多首次搜索结果都是通过附加图像和图像文件名来教学的。我如何通过电子邮件发送给有图像的人但不需要将其另存为文件?



我尝试过的事情:



谷歌的一些关键词C#,电子邮件和图像

As title.
I'm developing a system that can send a QR Code image to a member via e-mail. I want to build it in a Web Service for usage of many clients. The current method I use is saving the QR Code to be a real image file, and attaching it when sending e-mail, but failed when I use it on web service. The message says some error occurred on GDI+.
I've searched on Google with some keywords C#, e-mail, and image. Many of the first searched results are teaching the way with attaching image with image file name. How can I e-mail to someone with image but no need to save it as a file?

What I have tried:

Google with some keywords C#, e-mail, and image

推荐答案

将其转换为Base64字符串嵌入它,或将其用作CID:在您的电子邮件中嵌入图像。事实。 | SendGrid [ ^ ]

但是......在许多情况下它仍然不会显示:没有系统可以保证图像显示在所有电子邮件客户端中。如果用户确实需要并且不显示,则最好的方法是通过网页提供图像的点击此处链接。
Convert it to a Base64 string and embed it, or use it as a CID: Embedding Images in Your Emails. The Facts. | SendGrid[^]
But...it still isn't going to show in many cases: there is no system which will guarantee that images are displayed in all email clients. The best approach is to provide a "click here" link to the image via a webpage if the user really needs it and it isn't displayed.


这篇关于如何发送电子邮件包含图像而不将图像保存为文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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