Help with customer suport use case: how to reply to created tickets?

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Developer, Contributor

seanm
Posts: 12
Joined: 06 Jan 2021, 22:34

Re: Help with customer suport use case: how to reply to created tickets?

Post by seanm »

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...
SL-Gundam
Posts: 646
Joined: 06 Jul 2011, 14:17

Re: Help with customer suport use case: how to reply to created tickets?

Post by SL-Gundam »

It matches properly when its ""First Last" <name@example.com>" the part after that is the issue.
It's not a situation we've ever had to deal with. But yes we need to make sure EmailReporting handles it properly.
Exchange does something similar i believe. I'll check that line to make sure we cover it properly
seanm
Posts: 12
Joined: 06 Jan 2021, 22:34

Re: Help with customer suport use case: how to reply to created tickets?

Post by seanm »

That worked, thanks!
Post Reply