简体   繁体   English

c#winforms从Outlook模板文件创建电子邮件

[英]c# winforms create email from outlook template file

I am creating a mail using winforms like so: 我正在使用winforms创建邮件,如下所示:

private void CreateOutlookEmail(string addresses)
        {
            try
            {
                Outlook.Application outlookApp = new Outlook.Application();
                Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
                mailItem.Subject = "This is the subject";
                mailItem.To = addresses;
                mailItem.Body = "This is the message.";
                mailItem.Importance = Outlook.OlImportance.olImportanceLow;
                mailItem.Display(false);
            }
            catch (Exception eX)
            {
                throw new Exception("cDocument: Error occurred trying to Create an Outlook Email"
                                    + Environment.NewLine + eX.Message);
            }
        }

Is it possible to actually insert the email addresses/subject into a saved outlook template (.oft file) from within a winforms app? 是否可以从Winforms应用程序中实际将电子邮件地址/主题插入已保存的Outlook模板(.oft文件)中?

The OFT file would be somewhere in the root of the application. OFT文件将位于应用程序根目录中。

Do you mean you need to modify an existing OFT file? 您是说需要修改现有的OFT文件吗? You can do that using Redemption and its RDOSession .GetMessageFromMsgFile 您可以使用Redemption及其RDOSession .GetMessageFromMsgFile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM