我在 c# 中使用此代码发送电子邮件。我希望这封电子邮件基于模板。此电子邮件包含图像和样式。我想更改电子邮件的某些内容(例如,姓名、链接等)。任何想法如何去做?代码如下,
private void button1_Click(object sender, EventArgs e)
{
// Create outlook application object.
var outlookApplication = new Microsoft.Office.Interop.Outlook.Application();
// Create mail message.
var newMail = (Microsoft.Office.Interop.Outlook.MailItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
newMail.To = "example@exam.com";
newMail.Subject = "Example";
newMail.SentOnBehalfOfName = "team@iny.co.uk";
newMail.Attachments.Add(@"c:\New\DebriefReportTemplate.docx");
newMail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
newMail.HTMLBody = "<p>Dear Example,</p><p>Example example.</p>";
newMail.Display(true);
}