note 117473 added to function.imap-fetchheader

From: Date: Mon, 15 Jun 2015 14:03:57 +0000
Subject: note 117473 added to function.imap-fetchheader
Groups: php.notes 
Request: Send a blank email to php-notes+get-202869@lists.php.net to get a copy of this message
Here is a simple function to get an array with all headers. <?php function mail_header_parse($mbox,$msg){ $header=imap_fetchheader($mbox,$msg); preg_match_all("/^([^\r\n:]+)\s*[:]\s*([^\r\n:]+(?:[\r]?[\n][ \t][^\r\n]+)*)/m",$header,$matches,PREG_SET_ORDER); foreach($matches as $match){ $match[2]=iconv_mime_decode($match[2],ICONV_MIME_DECODE_CONTINUE_ON_ERROR,'utf-8'); if(is_array($headers[$match[1]])){ $headers[$match[1]][]=$match[2]; }elseif(isset($headers[$match[1]])){ $headers[$match[1]]=array($headers[$match[1]],$match[2]); }else{ $headers[$match[1]]=$match[2]; } } return $headers; } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 213.188.53.131 ---- Manual Page -- http://php.net/manual/en/function.imap-fetchheader.php Edit -- https://master.php.net/note/edit/117473 Del: integrated -- https://master.php.net/note/delete/117473/integrated Del: useless -- https://master.php.net/note/delete/117473/useless Del: bad code -- https://master.php.net/note/delete/117473/bad+code Del: spam -- https://master.php.net/note/delete/117473/spam Del: non-english -- https://master.php.net/note/delete/117473/non-english Del: in docs -- https://master.php.net/note/delete/117473/in+docs Del: other reasons-- https://master.php.net/note/delete/117473 Reject -- https://master.php.net/note/reject/117473 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202869) next »