Jump to content

Exploding at real Breaks not wraps


cooldude832

Recommended Posts

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???

Link to comment
https://forums.phpfreaks.com/topic/79343-exploding-at-real-breaks-not-wraps/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.