Re: How to parse raw mail headers and messages?
| From: | Richard Lynch | Date: | Mon, 18 Sep 2006 19:15:05 +0000 |
| Subject: | Re: How to parse raw mail headers and messages? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241894@lists.php.net to get a copy of this message | ||
On Mon, September 18, 2006 1:48 am, Mathijs wrote:
> Is there a way to parse mail headers from a RAW mail received from
> sendmail?
There MUST be a way, or none of us could get email... :-)
> Like extracting the from, reply-to etc.. etc.. and also the
> message(s).
You know the headers are "done" when you hit a blank line.
Finding individual headers is pretty much a case of testing for "From:
" or whatever at the beginning of a line.
> Also mabye Multipart email's en attachments?
Sure.
One of the headers will have the "separator" and then you just explode
on that.
Due to the vagaries of various MTAs, if you need a GENERAL solution
for email that anybody can just use, I'd try to go with something
pre-packaged from http://phpclasses.org or PECL or PEAR or...
If you are just trying to read your own email from a single server,
you could probably hack something just as fast as you could fight
through the docs on a pre-packaged version.
Also see http://php.net/imap of course, as noted previously.
--
Like Music?
http://l-i-e.com/artists.htm