PYWIN32-限制,通过潜在发件人列表进行过滤
我需要迭代项目中的每一个电子邮件。我有20000多封邮件。因此,我读到我需要使用限制函数。我发现了示例如何限制到一个特定域,
messages = messages.Restrict("@SQL=(urn:schemas:httpmail:SenderEmailAddress LIKE '%@domain.com')")
如果我想使用的100多个域或多个域(超过100个)发件人,我需要使用什么?与所有域的逻辑或连接器一起,这是一个巨大的限制函数,还是我可以以某种方式将列表输入到限制性语句中?
编辑:
我意识到,如果我使用此代码运行限制函数,它只是向我显示了LEN(消息)功能,即有0个电子邮件,而我可以在Outlook中看到一堆电子邮件,并在过滤器中使用使用过的域。我在做什么错?
I need to iterate through every email within my project. I have more than 20000 mails. Therefore i read I need to use the restrict function. I found examples how to restrict to one specific domain
messages = messages.Restrict("@SQL=(urn:schemas:httpmail:SenderEmailAddress LIKE '%@domain.com')")
What do I need to use if have more than 100 domains or multiple (more than 100) Senders I want to use? Would it be a huge restrict function with logical OR connectors with all of the domains or can I input somehow a list into the restrict statement?
EDIT:
and i realized if i run a restrict function with this code, it just shows me with the len(messages) function that there are 0 emails while i can see a bunch of emails in outlook with used domain in the filter. what am i doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,您需要在搜索字符串中使用逻辑
或
运算符。在使用字符串比较过滤项目文章。另外,您可能会发现以下文章有所帮助:但我建议您分别处理每个域,因此您可以在没有冻结的情况下进行Outlook运行,并且可以在逻辑束中处理项目,尤其是当您有一百个域名搜索时。
Typically you would need to use the logical
OR
operator in the search string. Read more about that in the Filtering Items Using a String Comparison article. Also you may find the following articles helpful:But I would recommend handling each domain separately, so you will get Outlook running without freezes and will be able to process items in a logical bunch, especially when you have a hundred of domain names to search for.
如果要滤除内部发件人,并且仅处理组织外部的发件人,请检查
senderemailtype
属性 - 它将是“ ex”使用Exchange Server)和
“ SMTP”
用于外部发件人。If you want to filter out internal senders and only process the senders outside your organization, check the
SenderEmailType
property - it will be"EX"
for the internal senders (assuming you are using Exchange Server) and"SMTP"
for the external senders.