imap_search ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi ! it works if there is / are emails in the box before script run (i use
cli not web based) but after it works 1 time it doesnt work again it enters
to  infinite loop ,
at that line
while(!$emails) { $emails = imap_search($inbox,'ALL'); echo "email yok\n";
print_r($emails); }

 imap_search($inbox,'ALL'); it doesn't try to research emails in $inbox,
doesn't it stay as connected or it's just for 1 time use :S ? should i reuse
imap_open everytime when i need to use imap_search ?

$inbox = imap_open($hostname,$usernamex,$password) or die('Cannot connect to
domain:' . imap_last_error());

function onayla()
{
global $inbox;
$emails = imap_search($inbox,'ALL');
while(!$emails) { $emails = imap_search($inbox,'ALL'); echo "email yok\n";
print_r($emails); }
echo "\nyeaah"; print_r($emails);
if($emails) {
rsort($emails);
echo "Number of email:".imap_num_msg($inbox);
foreach($emails as $email_number) {

$overview = imap_fetch_overview($inbox,$email_number,0);
if(stristr($overview[0]->subject,"Test"))
{
$message = imap_fetchbody($inbox,$email_number,1);
echo "$message\n\r";
//$link=arasi('activate:','-- The',$message); //echo "\n\r".$link;
#fwrite(fopen("deneme.txt",w),file_get_contents($link));
//imap_delete($inbox,'1:*');
//imap_expunge($inbox);
}


}

}
imap_delete($inbox,'1:*');
imap_expunge($inbox);
}

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux