Closed pool-alpin closed 1 year ago
Subject rules won't trigger
Do other rules work with Microsoft 365 accounts?
Yes, automatic workflows for eg body content rules trigger as expected.
It is as if Freescout can't "see" the subject line in mails received via MS365.
Add the following code to the line 819 in /Modules/Workflows/Entities/Workflow.php:
\Log::error('Subject raw: '.$conversation->subject.'; Subject base64: '.base64_encode($conversation->subject).'; Comparison result: '.(int)$or_true);
and send us the output from laravel-yyyy-mm-dd.log
in Manage > Logs > App Logs.
and send us the output from
laravel-yyyy-mm-dd.log
in Manage > Logs > App Logs.
Try this code and send the result:
\Log::error('Subject raw: '.$conversation->subject.'; Subject base64: '.base64_encode($conversation->subject).'Value raw: '.$value.'; Value base64: '.base64_encode($value).'; Comparison result: '.(int)$or_true);
By some reason Workflow condition contains only "is just" instead of "this is just a test". Can you give a screenshot of the Workflow condition? Try to type manually "this is just a test" into Condition and try again.
contains "is just" is correct, since it is intended to trigger for a subject like "this is just a test".
Sorry for the confusion.
Try this code and send the result:
\Log::error('Subject raw: '.$conversation->subject.'; Subject base64: '.base64_encode($conversation->subject).'; Value raw: '.$value.'; Value base64: '.base64_encode($value).'; Comparison result: '.(int)$or_true.'; Operator: '.$operator.'; Contains: '.(int)\Str::contains($conversation->subject, $value).'; Strstr: '.(int)strstr($conversation->subject, $value));
One more test:
\Log::error('Subject raw: '.$conversation->subject.'; Subject base64: '.base64_encode($conversation->subject).'; Value raw: '.$value.'; Value base64: '.base64_encode($value).'; Comparison result: '.(int)$or_true.'; Operator: '.$operator.'; Contains: '.(int)\Str::contains($conversation->subject, $value).'; Strstr: '.(int)strstr($conversation->subject, $value).'; is_string1: '.(int)is_string($conversation->subject).'; is_string2: '.(int)is_string($value).'; Contains2: '.(int)\Str::contains(mb_strtolower($conversation->subject), mb_strtolower($value)));
Now try to change the line 818 to:
$or_true = self::compareText($conversation->subject."", $value, $operator);
error | production | 2023-07-17 15:25:31 | Subject raw: this is just a test; Subject base64: dGhpcyBpcyBqdXN0IGEgdGVzdA==; Value raw: is just; Value base64: aXMganVzdA==; Comparison result: 1; Operator: contains; Contains: 1; Strstr: 0; is_string1: 0; is_string2: 1; Contains2: 1
🤩
Fixed in Workflows Module v1.0.47
Amazing, thank you! 🙏
PHP version: 8.2.5 FreeScout version: 1.8.85
I'm having problems with workflow rules for the mail subject not triggering and attributed them to a faulty server setup. However, after installing on several different test systems, I can narrow down the problem to happening with Microsoft 365 accounts only.
With gmail and icloud accounts, everything works as expected. Are there Microsoft 365 users out there experiencing the same problem?
Below is a fetch-log with a message that didn't trigger the workflow, hoping this helps to investigate this further.