发送包含存储在数据库中的嵌入图像的电子邮件。 [英] Sending email with embedded image stored in the database.

查看:332
本文介绍了发送包含存储在数据库中的嵌入图像的电子邮件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的应用程序已经发送带有嵌入式图像的电子邮件,但这次图像都存储在数据库中。

我无法弄清楚如何阅读和处理存储的图像成为电子邮件的一部分。



提前付款



我尝试过:



Hi,

My application is already sending email with embedded image, but this time the images were all stored in a database.
I can't figure it out on how to read and process the stored image to be part of the email.

Thanks in advance

What I have tried:

below code is for reading image from file path.

using (FileStream fileStream = new FileStream(Server.MapPath("~/" + fname), FileMode.Open, FileAccess.Read))
{
  content = new byte[fileStream.Length];
  fileStream.Read(content, 0, content.Length);
}

fileAttach.Content = content;

                CreateAttachmentType attachmentRequest = new CreateAttachmentType();
                attachmentRequest.Attachments = new AttachmentType[1];
                attachmentRequest.Attachments[0] = fileAttach;
                attachmentRequest.Attachments[0].IsInline = true;
                attachmentRequest.Attachments[0].ContentId = FileName;
                attachmentRequest.ParentItemId = emailResponseMessage.Items.Items[0].ItemId;

推荐答案

像理查德所说:



如何在存储在数据库中的正文中发送嵌入式图像邮件 [ ^ ]
Like Richard said:

how to send embedded image mail in body that stored in database[^]


这篇关于发送包含存储在数据库中的嵌入图像的电子邮件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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