help with imap_search function
-
Hello All, I am using the imap_search function and I want to return a list of all mail ids flagged as important. I am using the function this way.
$rst = imap_search($mbox,"FLAGGED");
if($rst===false) { echo "miss"; } else { $cnt = count($rst); for ($i=0; $i<$cnt; $i++) { echo "Match found in Msg#: $rst\[$i\]\\n"; } }
The output from above produces "miss". I suspect my search string is wrong, but for all my searching I can not find a valid example of its propper usage. The mailbox I am using has 5 email messages in it with one marked as important. Any ideas? Thanks in advance!
-
Hello All, I am using the imap_search function and I want to return a list of all mail ids flagged as important. I am using the function this way.
$rst = imap_search($mbox,"FLAGGED");
if($rst===false) { echo "miss"; } else { $cnt = count($rst); for ($i=0; $i<$cnt; $i++) { echo "Match found in Msg#: $rst\[$i\]\\n"; } }
The output from above produces "miss". I suspect my search string is wrong, but for all my searching I can not find a valid example of its propper usage. The mailbox I am using has 5 email messages in it with one marked as important. Any ideas? Thanks in advance!
nm, I was looking for the wrong thing to begin with. I needed to find emails witha return receipt so I can move them to a different folder. Do this was easy enough with the strpos function looking for "Return-Receipt-To" in the returned string from imap_fetchheader(). From here it is easy enough to use the imap_mail_move() function (also using the imap_expunge before you close the imap connection). ...cause I share :)