note 51546 added to function.imap-fetchheader
| From: | dj_doktoratupskirtdotcz at osu1 dot php dot net | Date: | Sun, 03 Apr 2005 14:17:49 +0000 |
| Subject: | note 51546 added to function.imap-fetchheader | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87402@lists.php.net to get a copy of this message | ||
I spend lot of time find out how I can detect messages with
different priorities. When I read users notes I remember
function imap_fetchheader which show header of message
and additional headers too. Because I'm so lazy to work with
regular expressions I required my frend for writing code
- thanx Znouza.
And there is... :)
<?php
// connecting to imap mailserver
$connection = @imap_open("{localhost:143/imap}INBOX", "your_username",
"your_password");
// get imap_fetch header and put single lines into array
$header = explode("\n", imap_fetchheader($connection, 1));
// browse array for additional headers
if (is_array($header) && count($header)) {
$head = array();
foreach($header as $line) {
// is line with additional header?
if (eregi("^X-", $line)) {
// separate name and value
eregi("^([^:]*): (.*)", $line, $arg);
$head[$arg[1]] = $arg[2];
}
}
}
// now are all contained additional headers in array $head
?>
----
Manual Page -- http://www.php.net/manual/en/function.imap-fetchheader.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51546
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51546&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51546&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51546&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51546&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51546&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51546&report=yes
Search -- http://master.php.net/manage/user-notes.php