Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.