在Outlook 2007 C#中获取安全发件人列表 [英] Get Safe sender list in Outlook 2007 C# Add in

查看:125
本文介绍了在Outlook 2007 C#中获取安全发件人列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在C#.NET 4.0中创建了一个Outlook 2007加载项.

I have created an Outlook 2007 add-in in C#.NET 4.0.

我想在我的C#代码中阅读安全发件人列表.

I want to read the safe sender list in my C# code.

        if (oBoxItem is Outlook.MailItem)
        {
            Outlook.MailItem miEmail = (Outlook.MailItem)oBoxItem;
            OlDefaultFolders f = Outlook.OlDefaultFolders.olFolderContacts;

            if (miEmail != null)
            {
                string body = miEmail.Body;
                double score = spamFilterObject.CalculateSpamScore(body);

                if (score <= 0.9)
                {
                    miEmail.Move(mfJunkEmail);
                }
            }
        }

因此,以上代码将所有电子邮件都移至了垃圾邮件,即使它们已存在于安全发件人列表中也是如此.因此,我想获取安全的发件人列表,以便避免垃圾邮件检查.

So, the above code moves all email to spam, even though they are present in the safe sender list. Thus I want to get the safe sender list so that I can avoid this spam checking.

有人可以帮我吗?

推荐答案

Outlook对象模型不公开这些列表(出于或多或少明显的原因).可以直接从注册表中读取安全发件人列表:

The Outlook object model doesn't expose these lists (for more or less obvious reasons). The safe sender list can be read straight from the registry at:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\[PROFILE NAME]\0a0d020000000000c000000000000046\001f0418

此二进制注册表项包含双字节字符,以分号(;)分隔.

This binary registry key contains double-byte characters, separated by a semicolon (;).

映射到此注册表项的MAPI属性是 PR_SPAM_TRUSTED_SENDERS_W,此处.

The MAPI property mapping onto this registry key is PR_SPAM_TRUSTED_SENDERS_W, documented here.

这篇关于在Outlook 2007 C#中获取安全发件人列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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