zbateson/mail-mime-parser
PSR-compliant, testable MIME email parser for PHP 8.1+ as an alternative to imap* and PEAR. Parses RFC 822/2822/5322 messages from strings, resources, or PSR-7 streams; standards-compliant yet forgiving, with a cleaned-up 4.x API.
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/3.0.4...3.0.5
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/3.0.3...3.0.4
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/3.0.2...3.0.3
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/3.0.1...3.0.2
Fixes version constraints for php-di, guzzlehttp/psr7 and phpunit.
Logging support, pass in a LoggerInterface to the constructor or call MailMimeParser::setGlobalLogger. Not much is actually logged at this point (please submit pull requests to add useful log messages)
ErrorBag class -- most user classes extend ErrorBag which allows classes to keep track of errors by calling addError, and users to call getErrors or getAllErrors (to include errors in child classes).
Additional validation on objects is not performed, but can be done by passing 'true' as the validate parameter on getErrors/getAllErrors. By default only errors encountered without additional validation are added.
See IErrorBag class for documentation.
If ParserManagerService can't find a parser for a PartBuilder, CompatibleParserNotFoundException will be thrown. This would only happen if customizing the used parsers passed on to ParserManagerService since the default set includes a 'catch-all' with NonMimeParserService.
protected AbstractHeader::setParseHeaderValue renamed to parseHeaderValue, and signature changed.
Can look up comment parts in headers -- use IHeader::getAllParts to return all parsed parts including comment parts.
GenericHeader getValue returns a string value of the combination of all its non-comment parts. This applies to any header that doesn't have a more specialized header type (not an address, date, id, parameter, received or subject header), see HeaderFactory docs for specifics.
IHeader now has a getComments() method that returns a string array of comments. ReceivedHeader no longer has protected members $comments and $date ($date is now private -- still has AbstractHeader::getComments(), and ReceivedHeader::getDateTime())
Switched to PHP-DI, users can provide a array|string|DefinitionSource to override definitions
Refactored Header classes to depend on their respective IConsumerService classes they need
Refactored ConsumerService classes to define which sub-ConsumerService classes they depend on. Removed ConsumerService.
Cleaned up method return types and parameter types.
Added an AbstractHeader::from which returns IHeader objects from a passed header line, or header name/value pair. Static method can be called on a sub class which returns its type, for example AddressHeader::from would return an AddressHeader regardless of the name parameter or name of header in the passed line.
Refactored HeaderPart classes with the following goals:
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/2.4.0...3.0.0
Logging support, pass in a LoggerInterface to the constructor or call MailMimeParser::setGlobalLogger. Not much is actually logged at this point (please submit pull requests to add useful log messages)
ErrorBag class -- most user classes extend ErrorBag which allows classes to keep track of errors by calling addError, and users to call getErrors or getAllErrors (to include errors in child classes).
Additional validation on objects is not performed, but can be done by passing 'true' as the validate parameter on getErrors/getAllErrors. By default only errors encountered without additional validation are added.
See IErrorBag class for documentation.
If ParserManagerService can't find a parser for a PartBuilder, CompatibleParserNotFoundException will be thrown. This would only happen if customizing the used parsers passed on to ParserManagerService since the default set includes a 'catch-all' with NonMimeParserService.
protected AbstractHeader::setParseHeaderValue renamed to parseHeaderValue, and signature changed.
Can look up comment parts in headers -- use IHeader::getAllParts to return all parsed parts including comment parts.
GenericHeader getValue returns a string value of the combination of all its non-comment parts. This applies to any header that doesn't have a more specialized header type (not an address, date, id, parameter, received or subject header), see HeaderFactory docs for specifics.
IHeader now has a getComments() method that returns a string array of comments. ReceivedHeader no longer has protected members $comments and $date ($date is now private -- still has AbstractHeader::getComments(), and ReceivedHeader::getDateTime())
Switched to PHP-DI, users can provide a array|string|DefinitionSource to override definitions
Refactored Header classes to depend on their respective IConsumerService classes they need
Refactored ConsumerService classes to define which sub-ConsumerService classes they depend on. Removed ConsumerService.
Cleaned up method return types and parameter types.
Added an AbstractHeader::from which returns IHeader objects from a passed header line, or header name/value pair. Static method can be called on a sub class which returns its type, for example AddressHeader::from would return an AddressHeader regardless of the name parameter or name of header in the passed line.
Refactored HeaderPart classes with the following goals:
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/2.3.0...2.4.0
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/2.2.3...2.3.0
Huge thank you to @phpfui for this release and migration to php 7.1+.
Full Changelog: https://github.com/zbateson/mail-mime-parser/compare/2.2.2...2.2.3
#189 fixes a documentation error thanks to @naitsirch #197 Fix PHP 8.1 return type deprecation notices. @alexei-bykovski
Fix for #160 : empty utf8 quoted not parsed correctly, thanks @jszaszi
Fixes:
#184 Adding #[\ReturnTypeWillChange] for PHP8.1 compatibility
Thanks @phpfui
Fixes #165 -- separates email address parsing into its own consumer so invalid characters can be ignored within an '<' and '>' chars representing the email address.
Fix an issue parsing long RFC2231 header values #182
Fixes #182
Huge thank you to the project sponsors who helped make this release happen.
Proxy parser refactor/fix, testing, documentation.
Thanks to my sponsors @SecuMailer, @mxguardian and @ericlbarnes
Changes and progress (and any issues you find) in #171
Adds support for guzzlehttp/psr7 v2, thanks to @Nielsvanpach
Fixes "SplFixedArray usage is incompatible with PHP 8.0" #151 thanks to @phpfui in #154
Return-Path should be handled as an AddressHeader ( #138 thanks @mariuszkrzaczkowski )
Defaults to multipart/mixed for any multipart type that isn't known #115
How can I help you explore Laravel packages today?