使用完整字符串进行IMAP搜索 [英] IMAP search with a full string

查看:49
本文介绍了使用完整字符串进行IMAP搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试在收件箱中使用类似不再工作"的字符串搜索电子邮件,但问题是imap会向我返回包含3个单词的电子邮件列表,而不是包含不再工作"字符串的电子邮件列表

I am currently trying to search some email in my Inbox with a string like that "not working anymore" but the problem is that imap will return me the list of email containing the 3 words and not the string "not working anymore".

有什么办法解决这个问题吗?我没有包含此字符串的消息,但是由于上述问题,IMAP向我返回了2条结果.

Any idea how to resolve this? I have no messages containing this string, but the IMAP returns me 2 results because of the problem explained above.

a1 SEARCH BODY "not working anymore" 
* SEARCH 4090 7752

推荐答案

在客户端代码中过滤/验证服务器的结果.

Filter/verify the server's result in your client code.

更长的答案是IMAP服务器曾经做过您想做的事,但是随着用户希望以更智能,更模糊的方式更快地进行搜索,服务器开始实施它.例如,用户想要查找这样的消息:

The longer answer is that IMAP servers used to do what you want, but as users wanted smarter fuzzier faster searching, servers started implementing it. For example, users wanted to find messages like this:

foo foo foo foo foo foo foo not working
anymore foo foo foo foo

空格与您的搜索词不匹配.您认为服务器应该返回该消息吗?

The whitespace does not match your search term. Do you think the server should return that message?

IMAP规范对此问题保持沉默.在我阅读本文时,如果一条消息包含确切的字符串,则该规范说该消息必须与搜索匹配,但是,如果该消息不匹配,那么……那么,服务器和客户端应该采取行动使用户满意并带来世界和平.这意味着从服务器获得的搜索结果包含所有想要的消息,因此过滤不会遗漏任何结果.

The IMAP specification is silentish on the issue. As I read it, if a message contains the exact string, that specification says the message must match the search, but if the message doesn't, then... well, then server and client should act to satisfy the user and bring about world peace. This implies that the search result you get from the server contains all the messages you want, so filtering won't miss any results.

这篇关于使用完整字符串进行IMAP搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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