Download the PHP package divineomega/email-structure-parser without Composer
On this page you can find all versions of the php package divineomega/email-structure-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download divineomega/email-structure-parser
More information about divineomega/email-structure-parser
Files in divineomega/email-structure-parser
Package email-structure-parser
Short Description Email Structure Parser
License LGPL-3.0-only
Informations about the package email-structure-parser
Email Structure Parser
Given an IMAP stream and a message number, this library will parse the structure of multipart emails.
Installation
You can easily install the Email Structure Parser package using the following Composer command.
Usage
To use this parser, you must have first connect to a mail server using PHP's built-in
imap_open function. Once connected, you then need to retrieve a message number,
via the imap_search function.
Once you have a message number, you can pass it, along with the IMAP stream object,
into the EmailStructureParser. You can then call the getParts() method to
retrieve an array of parsed email parts split up by mime type.
See the example usage code below.
Attachment names are read from both MIME name parameters and standard content-disposition filename parameters. Base64 and quoted-printable parts are decoded automatically. If the IMAP structure or a requested body cannot be fetched, the parser now throws a RuntimeException instead of returning partially corrupted data.
Testing without a mailbox
The existing two-argument constructor remains unchanged. For deterministic tests, you may optionally supply a pre-fetched IMAP structure and a body-fetching callback as the third and fourth arguments.
Content IDs
Some emails embed images into the HTML content using cid: urls. These URLs link to the content ID of another part within the email, rather than being an absolute https:// URL that can be resolved normally.
If one exists, this content ID will be exposed via the contentId property of the Part:
All versions of email-structure-parser with dependencies
ext-imap Version *