JREAM
JREAM

Reputation: 5931

Getting IMAP Headers in PHP

Hey Guys, I am totally confused on PHP's imap functions, they are all over the place and I've dug through comments to get this far. I can do imap_fetchbody($connection, 5, null); and retrieve the entire message which gives me all that i need:

ie:

To: [email protected] Content-Type: multipart/mixed; boundary=001517570c8a681a5004a36a1fd6

--001517570c8a681a5004a36a1fd6 Content-Type: multipart/alternative; boundary=001517570c8a681a4804a36a1fd4

--001517570c8a681a4804a36a1fd4 Content-Type: text/plain; charset=ISO-8859-1

asdf

--001517570c8a681a4804a36a1fd4 Content-Type: text/html; charset=ISO-8859-1

asdf

--001517570c8a681a4804a36a1fd4-- --001517570c8a681a5004a36a1fd6 Content-Type: image/gif; name="ajax-loader.gif" Content-Disposition: attachment; filename="ajax-loader.gif" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gnruant80

... bunch of code here omitted ...

But I really want this information in an Array or Object to use it. without having to think up some regular expression to get data out of the entire texts above.

Does anyone know a way to do that or which php imap command to use? Or is there a place with really good examples anyone knows of?

Upvotes: 1

Views: 2013

Answers (1)

Tapos
Tapos

Reputation: 601

You can use a non null value for section parameter(3rd parameter). Please see second example of http://php.net/manual/en/function.imap-fetchbody.php. I think that is what you are searching.

Upvotes: 1

Related Questions