Re: Grab value of mail headers
| From: | Jason Wong | Date: | Thu, 25 Jul 2002 04:20:58 +0000 |
| Subject: | Re: Grab value of mail headers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109415@lists.php.net to get a copy of this message | ||
On Thursday 25 July 2002 11:47, Nicklas af Ekenstam wrote:
> Hi
>
> Could someone please enlighten me on a good way to grab the value for
> a given mail header once I've fetched the entire headers to a string
> using php:s imap_fetchheader() function?
>
> For an example I would like to look for a header called List-Id which
> may look like this:
>
> List-Id: <php-general.lists.php.net>
>
> And grab the value - <php-general.lists.php.net> - into a variable to
> use later on in my script.
You can preg_match(). Or you can probably use explode() with ': ' as the
separator.
> Bonus points if you could tell me a way to parse the entire headers
> into something useful like a set of key, value pairs using the header
> name as key and the value as value.
Once you've got one header working use a loop.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
We must believe that it is the darkest before the dawn of a beautiful
new world. We will see it when we believe it.
-- Saul Alinsky
*/