Subject Line Missing from Inbound Emails

Please help. I have recently installed Suitecrm and have followed a guide to integrate Suitecrm with Microsoft 365. I am trying to sync emails from office 365 mail with Suitecrm via OAuth. I have set up the External OAuth Provider, a connection, and an inbound email account. As shown in the image, my inbox in Suitecrm populates with the emails, but the subject line is missing and the emails cannot be opened. I am using Ubuntu 22.04, Suitecrm 8.2.3, PHP 8.0.28, Apache 2.4.52, and MariaDB 10.6.11.

Did you solve the problem meanwhile?

I am facing exactly the same issue.

Checked the /legacy/modules/Emails/templates/displaySubjectField.tpl . It seems like the listed mails have no $bean.id and the $bean.subject seems to be empty as well .

Have not found a solution yet. Its possible to switch from $bean.subject to $bean.name to display the subject, but then its not possible anymore to open the detail mail page (id necessary).

SuiteCRM 8.2.3
Windows + XAMPP
Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/7.4.33
Datenbank-Client Version: libmysql - mysqlnd 7.4.33

Tue Feb 28 06:17:06 2023 [6684][1][WARN] ModuleNameMapper | mapName | 'emails' not mapped to 'frontend'
Tue Feb 28 06:17:06 2023 [6684][1][DEPRECATED] Array
(
)

Tue Feb 28 06:17:06 2023 [6684][1][ERROR] Unable to find relationship emails_email_templates
Tue Feb 28 06:17:06 2023 [6684][1][WARN] emails_email_templates for emails_email_templates failed to load

Tue Feb 28 06:17:06 2023 [6684][1][ERROR] Unable to find relationship emails_email_templates
Tue Feb 28 06:17:06 2023 [6684][1][WARN] emails_email_templates_idb for emails_email_templates failed to load

Tue Feb 28 06:17:06 2023 [6684][1][DEPRECATED] Array
(
)

Tue Feb 28 06:17:06 2023 [6684][1][WARN] CSS File Dawn/yui.css not found
Tue Feb 28 06:17:07 2023 [6684][1][WARN] Email ID is Empty
Tue Feb 28 06:17:07 2023 [6684][1][DEPRECATED] Using row number in fetchByAssoc is not portable and no longer supported. Please fix your code.
Tue Feb 28 06:17:07 2023 [6684][1][WARN] Trying to get property of non-object: list view data "order by" is not defined
Tue Feb 28 06:17:07 2023 [6684][1][WARN] Trying to get property of non-object: list view data "sort order" is not defined
Tue Feb 28 06:17:07 2023 [6684][1][DEPRECATED] Using row number in fetchByAssoc is not portable and no longer supported. Please fix your code.
Tue Feb 28 06:17:07 2023 [6684][1][DEPRECATED] User::getPreference() should not be used statically.
Tue Feb 28 06:17:07 2023 [6684][1][DEPRECATED] User::getPreference() should not be used statically.
Tue Feb 28 06:17:07 2023 [6684][1][WARN] unknown or undefined folder type (we will use 'imap' instead): inbound
Tue Feb 28 06:17:07 2023 [6684][1][WARN] Request ssl value not found.
Tue Feb 28 06:17:07 2023 [6684][1][WARN] Requested folder is not defined
Tue Feb 28 06:17:07 2023 [6684][1][WARN] ImapHandler trying to use a non valid resource stream.
Tue Feb 28 06:17:07 2023 [6684][1][WARN] ImapHandler trying to use a non valid resource stream.
Tue Feb 28 06:17:08 2023 [6684][1][DEPRECATED] User::getPreference() should not be used statically.
Tue Feb 28 06:17:08 2023 [6684][1][DEPRECATED] User::getPreference() should not be used statically.
Tue Feb 28 06:17:08 2023 [6684][1][DEPRECATED] User::getPreference() should not be used statically.
Tue Feb 28 06:17:08 2023 [6684][1][DEPRECATED] Array
(
)

No unfortunately I did not find a solution, however I was informed that this is a known issue.

I was given the suggestion to try version 8.2.2, but that did not work for me either.

There’s a fix for that already, you can apply it manually if you need to

→ Fix #206 - Email Subject Line by jack7anderson7 · Pull Request #222 · salesagility/SuiteCRM-Core · GitHub

eventually that will make it into a release.

This fix doesn’t resolve the problem with the list view only in the detail view. It also propagates the issue into a case if you have a group email setup to create new cases, the load with a blank subject.

@rossm are you running 8.2.4? Does it work well there? I’m asking this because supposedly this went through testing, and what you’re describing would have been spotted. Maybe there are other fixes in that version that will make things work for you.

Also, with UI issues, often there are bits of screens hanging around in caches (plural - there is more than one). So sometimes the fix doesn’t mediatamente take effect. I suggest a few Admin / Repairs and browser hard-refreshes.

I first tested using 7.13 and replaced the displaySubjectField.tpl file with hot fix version. This fixed the issue in the record display but not the list view.

Then I tested using 8.2.4, which didn’t work in either the list or detail view, with or without hot fix.

Then I tried 8.3-beta and still doesn’t work either

I should say I can access the record with no issues, it is just the from field is completely blank and subject says ‘(no subject)’

1 Like

Did you try the Repairs and the Refreshes?

Is the behaviour the same with fresh emails, that arrived after the fix?

I am using SuiteCRM v. 8.2.4

Have it connected to Microsoft Azure | Office 365

Fix #206 (pgr post Feb 28) did not work for me.

Tried browser hard refreshes (Chrome/Firefox) and Admin/Repairs

External OAuth connections and Outbound Email work.

Inbound emails work. Just the subject line is missing per rossm’s screen shot on Apr 7

I was able to fix this with Outlook 365 by modifying InboundEmail.php function handleMimeHeaderDecode($subject) to the following:

    public function handleMimeHeaderDecode($subject)
    {
        $subjectDecoded = $this->getImap()->MimeHeaderDecode($subject);

        $ret = '';

        if (is_array($subjectDecoded)) {
            foreach ($subjectDecoded as $object) {
                if ($object->charset != 'default') {
                    $ret .= $this->handleCharsetTranslation($object->text, $object->charset);
                } else {
                    $ret .= $object->text;
                }
            }
        } else {
            $ret = $subjectDecoded;
        }

        return $ret;
    }

I am still unable to import emails but the data is now there.

2 Likes

Hi, @norrch , welcome to the Community! :tada:

Nice fix, maybe you could create a PR for it on Github?

1 Like

I am not sure, I haven’t been able to determine what the original use was. The code is setup to parse a dictionary, but from what I can see this is only impacting Outlook 365? How is Gmail different? I haven’t tested these alternative scenarios yet.

1 Like

Ok… you’re right to be prudent, this can get really complicated with email and SuiteCRM :sweat_smile:

Then maybe just open an Issue, without the PR, so the devs can take a look at it. Having your fix there helps focus the attention on the relevant bit of code.

Great ! Now i can see subject and from in the list ! Good job!

We must solve this for future releases. @pgr can you create the PR, i dont think it was created.

Thanks

I think I will wait for my other PR’s to be merged before opening new ones…

The problem remains in the email dashlet in v8.4.0-beta.

I applied the patch from @norrch and it fixed the issue. I believe a PR would make sense otherwise email is crippled in v8.4 and we really should have these basics working by now. Here are the before and after pictures.

applying @norrch fix worked for v8.3, v8.4-beta and now v8.4
image

Still not fixed in “upgrade” v.8.4.1.

My recommendation is not to do these “upgrades”. They only wipe out any fixes you’ve made that continue not to be made to the core code. For some reason, nobody appears to be actually using this in the development team because they would not be able to see emails. It is a shame but if you “upgrade” you will actually go backwards. This has carried through every V8 “upgrade” and, this and other similar nuisances, will waste your time or frustrate your clients.