cooldude832 Posted November 29, 2007 Share Posted November 29, 2007 I am working on reading my pop3 email , and I am trying to return the header data using the function, I get this fine. The question I have is since there is no consistency to the rows, I want to take each row of data, not a wrap of a long line, any idea beyond checking if it has a : in it??? Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 29, 2007 Share Posted November 29, 2007 stristr() Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 29, 2007 Author Share Posted November 29, 2007 i'm trying that with <?php $temp_2 = explode("\n",imap_fetchbody($mbox,$i,0)); $j = 0; foreach($temp_2 as $value){ if(strstr($value,": ")){ $j++; } $data[$i]['Header'][$j] .= trim($value); } ?> Simply but I think it will work Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 29, 2007 Author Share Posted November 29, 2007 I think this is pretty niffty what you think? <?php for($i = 1; $i <=$msg_count; $i++){ $temp = imap_fetchstructure($mbox,$i); if($temp['Type'] == 0){ $data[$i]['Body'] = imap_fetchbody($mbox,$i,1); $temp_2 = explode("\n",imap_fetchbody($mbox,$i,0)); $j = 0; foreach($temp_2 as $value){ if(strstr($value,": ")){ $pos = strpos($value, ": "); $key = trim(substr($value,0,$pos)); } $data[$i]['Header'][$key] .= " ".trim($value); } } } ?> the array $data has the body of the message + each header defiend by its key Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.