사용자가 문자열을 생성하고 전자 메일을 보내는 특정 옵션을 선택할 수있는 간단한 전자 메일 앱이 있습니다. 이메일에 이미지를 추가 할 수 있는지, 예를 들어 헤더 로고나 서명 등을보고 싶었습니다. 내가 봤던 연구는 매우 무겁고 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 프로그램을 추천합니다. –