如何使用主题行从邮箱搜索邮件
我正在使用IMAP读取邮箱.
I am using IMAP to read a mailbox.
现在可以使用SUBJECT LINE and FROM name
作为标记来搜索邮箱吗?
Now is it possible that I can search mailbox with SUBJECT LINE and FROM name
as flag ?
示例:是否可以定义搜索条件:
imap_search($login,'SUBJECT '.$sub.' FROM'.$ToSearch)
;
是否可以在搜索电子邮件中使用姓名和主题?
Example: is it possible to define search criteria :
imap_search($login,'SUBJECT '.$sub.' FROM'.$ToSearch)
;
Is it allowed to use from name and subject in search for an email ?
请参见 RFC 3501 的搜索命令"部分,以了解如何在IMAP中使用搜索功能. AND
操作是隐式的,因此您可以将条件彼此相邻:
See the SEARCH Command section of RFC 3501 to see how to use search functionality in IMAP. An AND
operation is implicit so you can just put conditions next to each other:
0001 SEARCH SUBJECT "hello world" FROM "john"
如果要执行OR
操作,则需要在条件前加上OR
关键字:
If you want an OR
operation instead, you need to prefix the criteria with the OR
keyword:
0002 SEARCH OR SUBJECT "hello world" FROM "john"
请注意,字符串用作子字符串搜索,即在这种情况下,FROM
将与"john"
和"john@malta.com"
都匹配.
Note that strings are used as substring search, i.e. the FROM
in these cases will match both "john"
and "john@malta.com"
.