Doc #73640 [Ver->Csd]: imap_search can't search HEADER

From: Date: Thu, 08 Oct 2020 14:54:11 +0000
Subject: Doc #73640 [Ver->Csd]: imap_search can't search HEADER
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17973@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73640&edit=1 ID: 73640 Updated by: phpdocbot@php.net Reported by: sistemisti-posta at csi dot it Summary: imap_search can't search HEADER -Status: Verified +Status: Closed Type: Documentation Problem Package: IMAP related PHP Version: 7.0.13 Assigned To: cmb Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmb Revision: http://git.php.net/?p=doc/en.git;a=commit;h=bab0d03aac3a3e6e0d18b8132ddc97d276ce3941 Log: Fix #73640: imap_search can't search HEADER Previous Comments: ------------------------------------------------------------------------ [2020-10-08 14:49:26] cmb@php.net > imap_search can't search all headers released by IMAP protocol > (RFC 3501). That is correct, because imap is built on top of libc-client, which still only supports IMAP2-format search criteria. Thus, changing to doc problem. ------------------------------------------------------------------------ [2016-12-02 09:12:23] sistemisti-posta at csi dot it Ps: the current error returned with $string = sprintf('%s %s "%s"','HEADER', 'Message-ID', 'kldjskljf@example.org'); imap_search($imapconn, $string, SE_UID); is PHP Notice: Unknown: Unknown search criterion: HEADER (errflg=2) in Unknown ------------------------------------------------------------------------ [2016-12-02 08:51:26] sistemisti-posta at csi dot it Description: ------------ imap_search can't search all headers released by IMAP protocol (RFC 3501). See at https://tools.ietf.org/html/rfc3501#section-6.4.4 You can perform the following command: HEADER <field-name> <string> But this option is not allowed from PHP imap_search. Expected result: ---------------- Something like: $string = sprintf('HEADER "%s" "%s"','Message-ID', 'dskljflsdjfskl@example.org'); imap_search($imapconn, $string, SE_UID); This should return the uid of message with the Message-ID found. Actual result: -------------- At the moment, to search an header I can use this workaround: $string = sprintf('%s "Message-ID: <%s>"','TEXT', 'dskljflsdjfskl@example.org'); imap_search($imapconn, $string, SE_UID); But it's not safe, because with TEXT I find all occurrences of string "Message-ID: <dskljflsdjfskl@example.org>" in headers or body too. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73640&edit=1

« previous php.doc.bugs (#17973) next »