1
我有一個簡單的小電子郵件應用程序,它允許用戶選擇某些選項來生成字符串併發送電子郵件。我想看看是否有可能將圖像添加到電子郵件中,即標題徽標或簽名等。我一直在研究的研究非常繁重,而且我對HTML知之甚少。誰能幫忙?我的代碼如下...使用Outlook Interop在電子郵件中嵌入圖像
using System;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Configuration;
namespace My_EmailSender
{
public class EmailSender:Notification
{
string emailRecipient = ConfigurationManager.AppSettings["emailRecipient"];
public void SendMail(string message)
{
try
{
var oApp = new Outlook.Application();
var oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
var oRecip = (Outlook.Recipient)oMsg.Recipients.Add(emailRecipient);
oRecip.Resolve();
oMsg.Subject = "Email Notification";
oMsg.Body = message;
// Display the message before sending could save() also but no need
oMsg.Send();
oMsg.Display(true);
oRecip = null;
oMsg = null;
oApp = null;
}
catch (Exception e)
{
Console.WriteLine("Problem with email execution. Exception caught: ", e);
}
return;
}
}
}
很容易使用的net.mail發送圖像直通前景樣本代碼,但是,如果您想發送大量電子郵件,我會推薦一個程序SendBlaster。 –