添加默认的Outlook签名中产生的电子邮件 [英] Add the default outlook signature in the email generated

查看:240
本文介绍了添加默认的Outlook签名中产生的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Microsoft.Office.Interop.Outlook.Application 生成电子邮件,并在屏幕上显示之前,用户可以发送。应用程序是一个的winform C#应用程序codeD中的 .NET Framework 3.5的SP1 ,这是的Microsoft Outlook 2003 。我使用下面的code:

I am using the Microsoft.Office.Interop.Outlook.Application to generate an email and display it on the screen before the user can send it. The application is a winform application coded in C# in the .NET Framework 3.5 SP1 and it is Microsoft Outlook 2003. I am using the following code:

public static void GenerateEmail(string emailTo, string ccTo, string subject, string body)
    {
        var objOutlook = new Application();
        var mailItem = (MailItem)(objOutlook.CreateItem(OlItemType.olMailItem));        
        mailItem.To = emailTo;          
        mailItem.CC = ccTo;
        mailItem.Subject = subject;
        mailItem.HTMLBody = body;
        mailItem.Display(mailItem);
    }

我的问题是:

我要如何插入/加谁正在使用中的电子邮件的应用程序的用户的默认签名生成的?
任何帮助AP preciated。

How do i insert/add the default signature of the user who is using the application in the body of the email generated? Any help appreciated.

推荐答案

看看下面的链接。它解释了其中的签名可以在文件系统中找到,以及如何正确地阅读。

Take a look at the link below. It explains where the signatures can be found in the file system as well as how to read them properly.

<一个href=\"http://social.msdn.microsoft.com/Forums/en/vsto/thread/86ce09e2-9526-4b53-b5bb-968c2b8ba6d6\">http://social.msdn.microsoft.com/Forums/en/vsto/thread/86ce09e2-9526-4b53-b5bb-968c2b8ba6d6

线程只提到视窗XP和Windows Vista的签名位置。我已经证实,Windows 7的展望签名住在同一个地方作为Vista系统。我还证实,签名位置是Outlook 2003中,2007年和2010年相同。

The thread only mentions Window XP and Windows Vista signature locations. I have confirmed that Outlooks signatures on Windows 7 live in the same place as Vista. I have also confirmed that the signature location is the same for Outlook 2003, 2007, and 2010.

下面是一个code样本,如果你选择走这条路。从<一个取href=\"http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/a05843c5-ac97-4516-93ad-80838622ffb3/\">this站点。

Here's a code sample if you choose to go this route. Taken from this site.

private string ReadSignature()
{
    string appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Signatures";
    string signature = string.Empty;
    DirectoryInfo diInfo = new DirectoryInfo(appDataDir);

    if(diInfo.Exists)
    {
        FileInfo[] fiSignature = diInfo.GetFiles("*.htm");

        if (fiSignature.Length > 0)
        {
            StreamReader sr = new StreamReader(fiSignature[0].FullName, Encoding.Default);
            signature = sr.ReadToEnd();

            if (!string.IsNullOrEmpty(signature))
            {
                string fileName = fiSignature[0].Name.Replace(fiSignature[0].Extension, string.Empty);
                signature = signature.Replace(fileName + "_files/", appDataDir + "/" + fileName + "_files/");
            }
        }
    }
        return signature;
}


编辑:<一href=\"http://stackoverflow.com/questions/15800911/programmatically-set-outlook-2013-signature-defaults\">See在这里找到默认签名的名称为Outlook 2013年或@ japel在这个线程的答案在2010年。


See here to find the name of the default signature for Outlook 2013 or @japel's answer in this thread for 2010.

这篇关于添加默认的Outlook签名中产生的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆