使用c#从outlook发送多个嵌入图像 [英] Send multiple embedded images from outlook using c#
本文介绍了使用c#从outlook发送多个嵌入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是使用c从Outlook发送单个嵌入图像非常精细的代码
Following is the code which sends single embedded image very fine from Outlook using c#
public void sendEMailThroughOUTLOOK()
{
try
{
Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
string imageCid = "image001.jpg@123";
oMsg.HTMLBody = String.Format("<body><img src=\"cid:{0}\"></body>", imageCid);
Attachment attachment1 = oMsg.Attachments.Add(@"E:\wallpapers\WRLDMAP.jpg", OlAttachmentType.olEmbeddeditem, null, "img");
attachment1.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", imageCid);
//Add an attachment.
String sDisplayName = "MyAttachment";
int iPosition = (int)oMsg.HTMLBody.Length + 1;
int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
//now attached the file
Outlook.Attachment oAttach = oMsg.Attachments.Add(@"C:\\SampleFile.txt", iAttachType, iPosition, sDisplayName);
//Subject line
oMsg.Subject = "Your Subject will go here.";
// Add a recipient.
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("abc8@in.com");
oRecip.Resolve();
oMsg.Send();
oRecip = null;
oRecips = null;
oMsg = null;
oApp = null;
}
catch (System.Exception ex)
{ }
}
我不知道如何发送多个嵌入式图像。上述代码需要进行哪些修改?
I dont know how to send multiple embedded images. What modifications are required in the above code?
推荐答案
这篇关于使用c#从outlook发送多个嵌入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文