Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New "References:" formatting in headers processed by Exchange? #531

Open
zax123 opened this issue Jan 12, 2022 · 0 comments
Open

New "References:" formatting in headers processed by Exchange? #531

zax123 opened this issue Jan 12, 2022 · 0 comments
Labels

Comments

@zax123
Copy link

zax123 commented Jan 12, 2022

Q A
ddeboer/imap version 1.12.2
PHP version 7.4.3
IMAP provider outlook.office365.com

Summary

I use this imap library (which is fantastic by the way), to automatically parse/process email coming in to a specific email account in Office 365. Lately, I've noticed that the "References:" header (which I look at to know if I've already processed an email already) has references that are comma-separated as opposed to space separated and the snippet of code in this library explodes references by space. Perhaps we need to explode by both space and comma? I'm not sure if Outlook servers are adding the comma, or the email is arriving like that.

Current behavior

Currently, the library explodes the references header by space:

    /**
     * Get message References (from headers).
     *
     * @return string[]
     */
    final public function getReferences(): array
    {
        $references = $this->getHeaders()->get('references');
        \assert(null === $references || \is_string($references));

        return null !== $references ? \explode(' ', $references) : [];
    }

How to reproduce: code & error stack trace

An email with comma-separated references in the header will not parse correctly when using the getReferences() function.

Expected behavior

The references in the header would be exploded either by comma or space and result in a clean array of references.

Thanks!

@zax123 zax123 added the bug label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant