I'm writing a command line script to go through a mailbox on the file
system.  PHP the binary is compiled with imap, I've confirmed by using
imap_headers to get the array of the 10,051 messages and printed the array
out.

Here's my code:

    #!/usr/local/bin/php -q
    <?php

    $id = $_SERVER["argv"][1];

    ini_set("max_execution_time","9000");

    list($usec, $sec) = explode(" ",microtime());
    $start = ((float)$usec + (float)$sec);

    $mbox = imap_open("/home/beckman/public_html/spamtracker/a-copy-of-spam", "", "") 
or die("can't open");

    print "Finding '$id' (Executing imap_search($mbox,'$id'))\n";
    $matches = imap_search($mbox, '$id');
    print_r($matches);

    #while(list($key,$val)=each($matches)) {
    #   echo "$key: $val\n";
    #}

    imap_close($mbox);
    ?>

Here's what I get when searching for a variety of different possibilities (no results 
being returned in $matches):

Finding 'ALL fat' (Executing imap_search(Resource id #1,'ALL fat'))
Finding 'ALL "fat"' (Executing imap_search(Resource id #1,'ALL "fat"'))
Finding 'BODY "fat"' (Executing imap_search(Resource id #1,'BODY "fat"'))

Then I put SE_UID as the last option in imap_search:
Finding 'BODY "fat"' (Executing imap_search(Resource id #1,'BODY "fat"',SE_UID))
Finding 'TO "[EMAIL PROTECTED]"' (Executing imap_search(Resource id #1,'TO 
"[EMAIL PROTECTED]"',SE_UID))

I get nothing in $matches ever.  What is going on?  Am I doing it wrong?
I've read the documentation and the contributed notes and copied and pasted
replacing the search strings and continue to fail.  Argh.

I know the word "fat" is in the body of more than 50 messages, as well as
in the headers, as there are 10,051 pieces of spam I'm trying to parse.

Peter
---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
[EMAIL PROTECTED]                             http://www.purplecow.com/
---------------------------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to