Re: Help with customer suport use case: how to reply to created tickets?
Posted: 19 Feb 2021, 18:11
So I've confirmed what's happening.
The parse_from_field() function uses the following regex:
/^(?:(?P<name>.*)<|)(?P<email>(?P<local>[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+)@(?P<domain>[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*))(?:>|)$/u
against a "From:" field of:
"First Last" <name@example.com> (by way Foo Bar <foobar@company.com>)
And it doesn't match the regex. You can experiment with it here: https://regexr.com/5msr7
It then stores the raw "From:" field as the 'email' key:
'email' => $p_from_address,
This I think is a mistake. From its name and usage, the 'email' key is expected to be an email address, but a "From:" field is not guaranteed to be an exact format and as you see above can even contain two email addresses within it. I think setting null would make more sense in this branch. I'll try to create and test a patch...
The parse_from_field() function uses the following regex:
/^(?:(?P<name>.*)<|)(?P<email>(?P<local>[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+)@(?P<domain>[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*))(?:>|)$/u
against a "From:" field of:
"First Last" <name@example.com> (by way Foo Bar <foobar@company.com>)
And it doesn't match the regex. You can experiment with it here: https://regexr.com/5msr7
It then stores the raw "From:" field as the 'email' key:
'email' => $p_from_address,
This I think is a mistake. From its name and usage, the 'email' key is expected to be an email address, but a "From:" field is not guaranteed to be an exact format and as you see above can even contain two email addresses within it. I think setting null would make more sense in this branch. I'll try to create and test a patch...