Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. help with imap_search function

help with imap_search function

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
algorithmsregexhelptutorialquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cjoki
    wrote on last edited by
    #1

    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!

    C 1 Reply Last reply
    0
    • C cjoki

      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!

      C Offline
      C Offline
      cjoki
      wrote on last edited by
      #2

      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 :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups