c# - 将 Picturebox 图像发送到您的默认电子邮件

标签 c# .net winforms email

在我的表单中,我有一个包含图像的图片框。我想弄清楚如何将我的图片框中的图像作为附件和我的默认电子邮件的正文。

这是我目前所拥有的:

这会打开我的默认电子邮件,即 outlook,但不会在正文中附加或粘贴图片。

    private void button1_Click(object sender, EventArgs e)
    {
       var url = "mailto:emailnameu@domain.com&SUBJECT=My Subject&body="+pictureBox1.Image+"&attachment=" + pictureBox1.Image;
       System.Diagnostics.Process.Start(url);
    }

当我在变量 &body="+pictureBox1.Image+ 中添加这一行时,会发生这种情况。它不会将图片粘贴到正文中,而是写入 System.Drawing.Bitmap

enter image description here

最佳答案

您不能使用 mailto 发送正文中的图像内容,它说 here

The special "body" indicates that the associated is the body of the message. The "body" field value is intended to contain the content for the first text/plain body part of the message. The "body" pseudo header field is primarily intended for the generation of short text messages for automatic processing (such as "subscribe" messages for mailing lists), not for general MIME bodies.

此外,出于安全原因,官方不支持附件。

关于c# - 将 Picturebox 图像发送到您的默认电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46551819/

相关文章:

C# 简单列表显示的问题

c# - 如何确定在 TableLayoutPanel 中单击的单元格?

c# - XAML 绑定(bind)组

.net - 将 Resharper6 与 Razor 一起使用时出现的问题

c# - 在 .NET 中,我什么时候必须引用外部库也引用的 DLL?

c# - 如何增量迭代大小为 n 的字节数组的所有可能值?

javascript - 如何从 3 个选项卡 API 中提取房地产列表?

c# - 如何将我的应用程序窗口置于最前面?

c# - 数据表上的行标题 - 显示在数据 GridView 中

c# - 在 winforms 中使用 c# 在选中列表框中的项目索引