For some reason I am having some troubling writing the regular expression to chop up an email header.
I want to write a function that takes an email's header, and returns an associative array for all the values. What im having problems with is the parsing of the actual email header. I tried this:
ereg ("([a-zA-Z0-9-]+): (.+)\n", $email_header, $reg_array);
but it seems to return the first header title, and the rest of the header.
This is what i want to do, for example an email header like this:
To: "jorge" <jorge@oh.com>
Subject: I like your pants.
Date: Fri, 27 Jul 2001 15:59:00 -0400
MIME-Version: 1.0
would get chopped up into an array like
{ "To" , "\"jorge\" <jorge@oh.com>",
"Subject", "I like your pants.",
etc, etc.
}
Thanks in advance.
..jorge