Why not extract the person's name using the AddressHeader?
I noticed you've implemented an EmailAddressParser to extract the name of a person attached to an email with this comment:
We don't use the special AddressHeader class because it doesn't seem to parse the person's name at all
MMP does extract name though, but perhaps there's a bug I'm not aware of? You should be able to call:
$fromHeader->getPersonName() and $fromHeader->getValue() for name and email. To get the full list of addresses, you can call $fromHeader->getAddresses() which returns AddressPart[], which has getEmail() and getName().
I'll submit a pull request for this to see if it's an easy fix for you. I noticed you do some extra filtering and I'll try to mimic that. Unfortunately from your readme it looks like I'd need an algolia account to run locally -- if it's too much of a nuisance feel free to close this and the pull request :)
All the best!
Thanks! Testing that there is no regression will be painful though ^^ (I need to re-run parsing on older emails). I'll keep the PR open, thanks for doing that work and I always like simplifying stuff. But I can't guarantee it will be treated soon, I'll probably test it in batch with other tasks.
No problem -- I also added your fallback for DateTime parsing into DateHeader in 1.0... so whenever that happens it might be worth upgrading as well.