Download the PHP package vaibhavpandeyvpz/phemail without Composer
On this page you can find all versions of the php package vaibhavpandeyvpz/phemail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download vaibhavpandeyvpz/phemail
More information about vaibhavpandeyvpz/phemail
Files in vaibhavpandeyvpz/phemail
Download vaibhavpandeyvpz/phemail
More information about vaibhavpandeyvpz/phemail
Files in vaibhavpandeyvpz/phemail
Vendor vaibhavpandeyvpz
Package phemail
Short Description A pure PHP MIME parser for parsing raw email files (.eml) with full support for multipart messages, nested structures, and RFC 2046 compliance.
License MIT
Homepage https://github.com/vaibhavpandeyvpz/phemail
Package phemail
Short Description A pure PHP MIME parser for parsing raw email files (.eml) with full support for multipart messages, nested structures, and RFC 2046 compliance.
License MIT
Homepage https://github.com/vaibhavpandeyvpz/phemail
Please rate this library. Is it a good library?
Informations about the package phemail
vaibhavpandeyvpz/phemail
A pure PHP MIME parser for parsing raw email files (.eml) with full support for multipart messages, nested structures, and RFC 2046 compliance.
Features
- ✅ Pure PHP - No external dependencies required
- ✅ RFC 2046 Compliant - Proper handling of multipart messages with boundaries, preamble, and epilogue
- ✅ Nested Structures - Supports deeply nested multipart messages and message/rfc822 types
- ✅ Header Parsing - Handles folded headers, continuation lines, and header attributes
- ✅ Attachment Detection - Automatically identifies attachments via Content-Disposition header
- ✅ Multiple Input Types - Accepts file paths, arrays, or iterators
- ✅ Immutable Objects - Thread-safe design with immutable message parts
- ✅ PHP 8.2+ - Modern PHP with strict types and latest language features
Requirements
- PHP 8.2 or higher
Installation
Basic Usage
Parsing a Simple Email
Parsing from Different Sources
Advanced Usage
Working with Multipart Messages
Extracting Attachments
Working with Nested Messages
Accessing Header Attributes
Recursive Part Traversal
API Reference
MessageParser
Methods
parse(string|array|\Iterator $payload, bool $withSubMessage = true): MessagePartInterface- Parses an email from file path, array of lines, or iterator
$withSubMessage: Whether to parse nested message/rfc822 parts recursively
MessagePartInterface
Header Methods
getHeaders(): array<string, HeaderInterface>- Get all headersgetHeader(string $name): ?HeaderInterface- Get a specific header (case-insensitive)getHeaderValue(string $name, ?string $default = null): ?string- Get header valuegetHeaderAttribute(string $header, string $attr, ?string $default = null): ?string- Get header attribute
Content Type Methods
getContentType(): string- Get Content-Type (defaults to "text/plain")isMultiPart(): bool- Check if multipart messageisMessage(): bool- Check if message/rfc822 typeisText(): bool- Check if text/* content type
Content Methods
getContents(): string- Get message body content (preamble for multipart)
Parts and Attachments
getParts(bool $recursive = false): array<MessagePartInterface>- Get nested partsgetAttachments(bool $recursive = false): array<MessagePartInterface>- Get attachments
HeaderInterface
getValue(): ?string- Get header valuegetAttributes(): array<string, string>- Get all attributesgetAttribute(string $name): ?string- Get specific attribute
Examples
Example 1: Simple Text Email
Example 2: Multipart with Attachments
Example 3: Complex Nested Structure
Supported Email Formats
- Plain text emails
- Multipart/mixed
- Multipart/alternative
- Multipart/related
- Multipart/signed
- Message/rfc822 (nested messages)
- Headers with folded lines
- Headers with attributes (charset, boundary, filename, etc.)
- Attachments with Content-Disposition
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project Home
All versions of phemail with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
The package vaibhavpandeyvpz/phemail contains the following files
Loading the files please wait ...