freescout-help-desk / freescout

FreeScout — Free self-hosted help desk & shared mailbox (Zendesk / Help Scout alternative)
https://freescout.net
GNU Affero General Public License v3.0
2.9k stars 481 forks source link

Email empty #1972

Closed afawaz2 closed 1 year ago

afawaz2 commented 2 years ago

We are having an issue where external replies to conversation or new conversations that are forwarded show up as empty, when we try to show original we also get an empty page with
as the body view. The headers show up as well.

Those messages have content in them because when we go to outlook we are able to see the message.

The log does not have any parsing error or fetching errors but we are seeing this issue in 2% of the emails we receive every day. I would like to debug the issue so any pointer would help, also a workaround that doesn't involve logging to outlook every time it happens would be helpful.

SecureCPU commented 1 year ago

Np. hopefully it stays fixed.

freescout-helpdesk commented 1 year ago

Thanks for the solution. We've updated the instruction: https://github.com/freescout-helpdesk/freescout/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-OAuth

mbl72 commented 1 year ago

I've just tried the solution described above. Upgraded to the latest version of Freescout (1.8.50, running php 8.1.14)

I've just sendt a test email. Sadly it did not fix the issue for me - The email is still blank :(

freescout-helpdesk commented 1 year ago

I've just tried the solution described above. Upgraded to the latest version of Freescout (1.8.50, running php 8.1.14)

  • Created a new Application in Azure with the extended permissions
  • Verified that the security defaults are disabled in Azure

I've just sendt a test email. Sadly it did not fix the issue for me - The email is still blank :(

Try to contact Webklex to debug together with him: https://github.com/Webklex/php-imap/issues/275#issuecomment-1379906628

freescout-helpdesk commented 1 year ago

I've just sendt a test email. Sadly it did not fix the issue for me - The email is still blank :(

This solution https://github.com/freescout-helpdesk/freescout/issues/1972#issuecomment-1385554715 fixed the issue for others. Make sure you are using FreeScout v1.8.35 or higher.

jopdorp commented 1 year ago

We are also experiencing this problem, #1972 does not work for us. We are using freescout 1.8.50, using the tiredofit docker image 1.6.19 with php 8.1 and tried php7.4 too. I've also tried upgrading to php-imap 4.1.2, but this doesn't solve the issue.

SecureCPU commented 1 year ago

I'm using Ubuntu 22.04.1 LTS in solution #1972 (comment) Idk if that makes a difference in docker or Ubuntu 20.04

freescout-helpdesk commented 1 year ago

@jopdorp @mbl72 Try to add all available permissions to the app in Azure and check.

jopdorp commented 1 year ago

At webklex they say that it works in their master branch. I tried upgrading to their master or to php-imap 5.0.0, but then there is a large chain of other libraries that would need to be updated, including laravel

freescout-helpdesk commented 1 year ago

There are two things here: 1) There was an issue in webklex/php-imap library which caused ab empty body issue. It has been fixed now. 2) Another reason of empty body - is Microsoft Azure glitch or incomplete configuration.

So all the tests without using Microsoft Azure will work fine now. We need to figure out what is causing empty body when Microsoft Azure is used.

jopdorp commented 1 year ago
  1. re was an issue in webklex/php-imap library which caused ab empty body issue. It has been fixed n

I think this wasn't fixed in the 4.1.1 version yet, but in 5.0.0, which freescout doesn't use yet

jopdorp commented 1 year ago

@jopdorp @mbl72 Try to add all available permissions to the app in Azure and check.

azure has hundres of permissions, I'm not sure I can just do this. Do you have a list of the permissions you're testing with? Then I can add those.

freescout-helpdesk commented 1 year ago

Empty body on webklex/php-imap side was fixed in https://github.com/Webklex/php-imap/releases/tag/4.1.0

Try to contact Microsoft Azure's support - maybe they can give an advice on what in their system may cause an empty body when fetching emails via IMAP.

jopdorp commented 1 year ago

that is a different issue https://github.com/Webklex/php-imap/issues/275#

freescout-helpdesk commented 1 year ago

that is a different issue Webklex/php-imap#275

There is no empty body fixes after https://github.com/Webklex/php-imap/releases/tag/4.1.0. This issue https://github.com/Webklex/php-imap/issues/275 has been created before the empty body issue has been fixed in webklex/php-imap 4.1.0

jopdorp commented 1 year ago

For now we are working around it by using a different e-mail provider and a different domain

jopdorp commented 1 year ago

that is a different issue Webklex/php-imap#275

There is no empty body fixes after https://github.com/Webklex/php-imap/releases/tag/4.1.0. This issue Webklex/php-imap#275 has been created before the empty body issue has been fixed in webklex/php-imap 4.1.0

Adding all available permissions is not an option, azure has hundreds of them, which I cannot just all add due to security reasons

freescout-helpdesk commented 1 year ago

Those who still have empty body issue - do you receive emails without body and without attachments or you have empty body and "undefined" attachment?

mbl72 commented 1 year ago

We have conversations with an empty body and with an "undefined" attachment. And the undefined attachment seems to contain the body of the email.

ghost commented 1 year ago

Yes, we also receive empty emails with an undefined attachment that appears to contain the body.

freescout-helpdesk commented 1 year ago

Those who still have empty body issue - do you receive emails without body and without attachments or you have empty body and "undefined" attachment?

For this kind of issue the fix has been applied in FreeScout v1.0.54. Let us know if empty body issue still persists after this release for MS365 accounts.

ThaStealth commented 1 year ago

We have an empty body without attachment

ghost commented 1 year ago

Now running v1.0.54, we're receiving emails from senders that would have previously had the undefined attachment included, but now we're getting no attachment or body text.

mbl72 commented 1 year ago

Now running v1.0.54, we're receiving emails from senders that would have previously had the undefined attachment included, but now we're getting no attachment or body text.

Same issue here..

BUT, The update to 1.0.54 did have some effect.

Previously, If I sent emails from my private account (not a M$ account), the text was missing, with the "undefined" attachment added to the conversation. Now the body is displayed correctly. Another test with an attachment resulted in a conversation with the attachement, but without any body content :(

If I sent a mail from my company account (A M$ account) the body is empty, and no attachments are visible.

If I try to use the "Show original" function, the following is displayed. "The original message could not be loaded from mail server, below is the latest truncated copy stored in database."

The message IS still on the server.

(Both email were sent with the same Outlook email client)

freescout-helpdesk commented 1 year ago

Another test with an attachment resulted in a conversation with the attachement, but without any body content :(

If I sent a mail from my company account (A M$ account) the body is empty, and no attachments are visible.

Please send examples to support@freescout.net

mbl72 commented 1 year ago

Another test with an attachment resulted in a conversation with the attachement, but without any body content :( If I sent a mail from my company account (A M$ account) the body is empty, and no attachments are visible.

Please send examples to support@freescout.net

I've sent the 3 examples including screenshots from Freescout

gerbenvandekraats commented 1 year ago

I am experiencing the same problem. Is it helpful if I also send samples to support@freescout.net? Or do you already have enough information?

Loak4156 commented 1 year ago

The problem is probably that the ticketing system does not correctly process the message encoding. Usually this is due to the fact that the letter contains a non-standard encoding that the system cannot correctly interpret. In addition, it is possible that the system cannot process all elements of the MIME structure of the email that display the content of the email.

In the case of a particular email, the reason may be that the content of the email is in a "multipart/related" section that contains multiple parts, including attachments. The ticketing system may not be able to process this correctly and will not display the contents of the email.

freescout-helpdesk commented 1 year ago

Some updates have been made in FreeScout v1.8.66 which may help to avoid empty body issue when using modern Microsoft OAuth IMAP authentication. All those who have this issue try to install FreeScout v1.8.66 and check.

mbl72 commented 1 year ago

Some updates have been made in FreeScout v1.8.66 which may help to avoid empty body issue when using modern Microsoft OAuth IMAP authentication. All those who have this issue try to install FreeScout v1.8.66 and check.

Sadly, for us the issue still remains open in 1.8.66

freescout-helpdesk commented 1 year ago

@mbl72 Can you send one email giving an empty body to support@freescout.net (but send directly, not as a ZIP archive).

mbl72 commented 1 year ago

@mbl72 Can you send one email giving an empty body to support@freescout.net (but send directly, not as a ZIP archive).

Just to be sure..

Send an email directly from the account to support@frescout.net ?? Or download the email from the Office mailbox and send the eml file to you ??

freescout-helpdesk commented 1 year ago

Send an email directly from the account to support@frescout.net (not as FWD or attachment).

mbl72 commented 1 year ago

support@freescout.net

Done :)

freescout-helpdesk commented 1 year ago

Our FreeScout instance successfully fetched the test email from support@freescout.net and fetched email has a body.

The support@freescout.net address is hosted on other than MS 365 email provider. It means the cause of your issue with an empty body is in Microsoft Office 365 configuration. Try to contact their support and ask what should be configured in MS 365 not to have the empty body in emails retrieved via IMAP with OAuth authentication. Send them this info too: https://github.com/freescout-helpdesk/freescout/issues/1972#issuecomment-1385554715

2023-03-04_14-30-03

mbl72 commented 1 year ago

Our FreeScout instance successfully fetched the test email from support@freescout.net and fetched email has a body.

The support@freescout.net address is hosted on other than MS 365 email provider. It means the cause of your issue with an empty body is in Microsoft Office 365 configuration. Try to contact their support and ask what should be configured in MS 365 not to have the empty body in emails retrieved via IMAP with OAuth authentication. Send them this info too: #1972 (comment)

2023-03-04_14-30-03

It would make sense, if ALL mails were blank. This, however, is not the case.

I did some more digging.. It seems to have something to do with mails that are internally relayed for the same tennant in Office365, which MIGHT have something to do with the mail headers.

We have several domains connected to the same tennant/account in Microsoft365, we also have 2 tennants. Doman A.com & B.com are on Tennant X. Domain C.com is on Tennant Y.

I tried this. When I send an email via my outlook client connected directly to Office 365 on the same tennant. (From z1@A.com to z2@A.com or from z1@B.com to z2@A.com - The mail body is blank.

When I send an email via my outlook client connected directly to Office 365 on the other tennant. (From z1@C.com to z2@A.com – Everything is fine.

And I'm fairly certain that the first thing the support-team from Microsoft asks for, is some kind of log.. Is there any way I can create a detailed log with Freescout? To see the communication between the mailserver and Freescout ??

freescout-helpdesk commented 1 year ago

Is there any way I can create a detailed log with Freescout? To see the communication between the mailserver and Freescout ??

Yes. Add APP_DEBUG=true to the .env file and clear cache. After that run in the console:

php artisan freescout:fetch-emails
mbl72 commented 1 year ago

Is there any way I can create a detailed log with Freescout? To see the communication between the mailserver and Freescout ??

Yes. Add APP_DEBUG=true to the .env file and clear cache. After that run in the console:

php artisan freescout:fetch-emails

I managed to enable the debugging. Tricky as we're using the TiredOfIt docker instance. The body IS returned from Office365.

I've sent the content from the fetch-emails to support@freescout.net

For others using the tiredofit version.

I did the following (after connecting to the console)

docker container exec -it freescout-app /bin/bash

cd /www/html nano config/app.php

Edit the 'debug' line
'debug' => true,

Save the file.

php artisan config:clear php artisan cache:clear php artisan freescout:fetch-emails

This returns the detailed information.

Edit app.config again to undo.

nano config/app.php

Edit the 'debug' line 'debug' => env('APP_DEBUG', false),

Save the file.

php artisan config:clear php artisan cache:clear php artisan freescout:fetch-emails

freescout-helpdesk commented 1 year ago

@mbl72 We've got an excerpt of php artisan freescout:fetch-emails output from you by email. It would be good to have the full output as a file: php artisan freescout:fetch-emails > /path/to/file.txt

mbl72 commented 1 year ago

@mbl72 We've got an excerpt of php artisan freescout:fetch-emails output from you by email. It would be good to have the full output as a file: php artisan freescout:fetch-emails > /path/to/file.txt

Done.

freescout-helpdesk commented 1 year ago

@mbl72 Can you please also prepare and send similar log for the case when the email is being successfully fetched into your FreeScout and have a body (to check the difference between two logs).

freescout-helpdesk commented 1 year ago

We've found the reason of the problem.

Those who have an empty body issue - to fix it right away download this file https://github.com/freescout-helpdesk/freescout/blob/master/overrides/webklex/php-imap/src/Message.php into your FreeScout into "overrides/webklex/php-imap/src/Message.php" and empty body issue will go away. The fix will be included in the next FreeScout release.

zhabi commented 1 year ago

Updated to the latest version 1.8.69 by docker. It is glad to see that most of the emails display the content successfully.

But there is still some problem:

  1. when try to “show original”, there is always showing “The original message could not be loaded from the mail server, below is the latest truncated copy stored in database”.
  2. there are still some emails failed to display the content. It become rare but still existing.
kwm365 commented 3 weeks ago

Yes, I can confirm that too. For us and other customers, it affects 50% to 80% of all emails. The problem is that you have to be able to view the originals when Freescout parses the emails, because Freescout generally does not display replies from the sender's previous emails (support agent). Freescout only shows what was written above the last reply from the support agent. However, customers often have the habit of marking previous emails with red comments, for example, in order to make better use of the context. Freescout should therefore have a function that allows such content to be displayed in the ticket history.