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.98k stars 489 forks source link

parse error when displaying an email #882

Closed stsimb closed 2 years ago

stsimb commented 3 years ago

Hello,

We send an automated email to our customers and set the Reply-to header to a mailbox handled by freescout. One of them replied the other day with some text on top of our email, which was quoted below, but freescout didn't display the customer's reply text on top, only the quoted text below.

Here is a screenshot of what the customer sent gmail

Here is a screenshot of what freescout displayed freescout

and here is the full source of this particular email full-email-source.txt

Thanks for your work! Sot.

stsimb commented 3 years ago

Another full email with the same problem -> full-email-source-2.txt

Looks like both email replies were sent using a Huawei mobile phone, android, Greek locale.

freescout-helpdesk commented 3 years ago

Can you forward one such email to support@freescout.net

stsimb commented 3 years ago

I've forwarded you a sample email.

Maybe something like this will fix the problem...

[root@freescout html]# diff -u app/Misc/Mail.php app/Misc/Mail.php.new
--- app/Misc/Mail.php   2020-11-07 04:09:16.000000000 +0000
+++ app/Misc/Mail.php.new       2020-11-24 11:45:08.120773431 +0000
@@ -69,6 +69,7 @@
         'regex:/<blockquote((?!quote)[^>])*>/', // General sepator. Should skip Gmail's <blockquote class="gmail_quote">.
         '<!-- originalMessage -->',
         '‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐',
+        '-------- Αρχικό μήνυμα --------',
         '--------------- Original Message ---------------',
     ];

I've patched our installation and I'm now waiting for a Huawei owner to reply to one of our emails ...

freescout-helpdesk commented 3 years ago

Make sure an email on two your screenshots is the same email. Check Message-ID in headers.

stsimb commented 3 years ago

Yeap, it's definitely the same email, I've checked the Message-ID header and it matches.

freescout-helpdesk commented 3 years ago

In the FreeScout how does it look in "Show Original" modal?

Can you send content of the "Body" tab of "Show Original" modal?

stsimb commented 3 years ago

Here is the content of the Body tab ...

<center><table style="border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="top"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="600"><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="top"><table style="border-collapse: collapse;min-width:100%;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:9px;" valign="top"><table style="border-collapse: collapse;max-width:100%; min-width:100%;" align="left" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:0; padding-right:18px; padding-left:18px;" valign="top"><p style="margin: 1em 0;padding: 0;">Σε ευχαριστούμε για την εμπιστοσύνη που μας έδειξες!</p><p style="margin: 1em 0;padding: 0;">Έχεις εκδώσει κωδικό πληρωμής για να ασφαλίσεις το όχημά σου για 365 ημέρες.</p><p style="margin: 1em 0;padding: 0;">Ο κωδικός ηλεκτρονικής πληρωμής είναι RF08903345510001276391067 και αντιστοιχεί στο ποσό των €133,46.</p><p style="margin: 1em 0;padding: 0;">Για να ενεργοποιηθεί το συμβόλαιό σου, μπορείς να πληρώσεις με αυτόν τον κωδικό μέχρι Κυριακή, 29 Νοεμβρίου 2020:</p><table style="border-collapse: collapse;" cellpadding="0" cellspacing="0" border="0"><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12" width="19" valign="top"><p style="margin: 0.5em 0;">•</p></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12"><p style="margin: 0.5em 0;">Με μετρητά στο ταμείο της τράπεζας. Ισχύει για τις Τράπεζες: Πειραιώς, Alpha Bank, Εθνική και Eurobank.</p></td></tr><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12" width="19" valign="top"><p style="margin: 0.5em 0;">•</p></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12"><p style="margin: 0.5em 0;">Με μεταφορά από το λογαριασμό σου στο ταμείο της τράπεζας που συνεργάζεσαι. Ισχύει για τις Τράπεζες: Πειραιώς, Alpha Bank, Εθνική και Eurobank.</p></td></tr><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12" width="19" valign="top"><p style="margin: 0.5em 0;">•</p></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12"><p style="margin: 0.5em 0;">Μέσω του e-banking σου.</p></td></tr><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12" width="19" valign="top"><p style="margin: 0.5em 0;">•</p></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12"><p style="margin: 0.5em 0;">Μέσω του phone banking σου.</p></td></tr><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12" width="19" valign="top"><p style="margin: 0.5em 0;">•</p></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" height="12"><p style="margin: 0.5em 0;">Με πληρωμή (μετρητά ή κάρτα) σε ένα κατάστημα ΟΠΑΠ οποιαδήποτε μέρα, μέχρι τις 14:00 την ημέρα που λήγει ο κωδικός πληρωμής. Αν ο κωδικός σου λήγει Σάββατο ή Κυριακή, σε κατάστημα ΟΠΑΠ μπορείς να πληρώσεις Δευτέρα με Παρασκευή.</p></td></tr></table><p style="margin: 1em 0;padding: 0;">Μετά την ολοκλήρωση της αγοράς, θα λάβεις το συμβόλαιο καθώς και τους Όρους Ασφάλισης στο email σου.</p></td></tr></tbody></table></td></tr></tbody></table><table style="border-collapse: collapse;min-width:100%;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" valign="top"><table style="border-collapse: collapse;max-width:100%; min-width:100%;" align="left" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px;" valign="top"><p style="margin: 0 0 1em 0;">Φιλικά,</p> Φαίδρα από Hellas Direct
                                                            </td></tr></tbody></table></td></tr></tbody></table><table style="border-collapse: collapse;min-width:100%;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding:0px" valign="top"><table style="border-collapse: collapse;min-width:100%;" align="left" width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px;" valign="top"><img style="-ms-interpolation-mode: bicubic;" align="left" title="Λογότυπο Hellas Direct" alt="Λογότυπο Hellas Direct" src="https://www.hellasdirect.gr/wizard//assets/images/for-emails/hdlogo-20130903.jpg" width="69" height="80"></td></tr></tbody></table></td></tr></tbody></table><table style="border-collapse: collapse;min-width:100%;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding:9px" align="center" valign="top"><table style="border-collapse: collapse;min-width:100%;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-left:9px;padding-right:9px;" align="center"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:9px; padding-right:9px; padding-left:9px;" align="center" valign="top"><table style="border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="top"><table style="border-collapse: collapse;display:inline;" align="left" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-right:10px; padding-bottom:9px;" valign="top"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;" align="left" valign="middle"><table style="border-collapse: collapse;" align="left" border="0" cellpadding="0" cellspacing="0" width=""><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="middle" width="24"><a style="word-wrap: break-word;" href="https://www.facebook.com/hellasdirect?ref=hl" target="_blank"><img style="-ms-interpolation-mode: bicubic;display:block;" title="Facebook" alt="Facebook" src="https://www.hellasdirect.gr/wizard//assets/images/for-emails/facebook-dark.png" height="24" width="24"></a></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-left:5px;" align="left" valign="middle"><a style="word-wrap: break-word;font-family: Tahoma, Verdana, Segoe, sans-serif;font-size: 9px;text-decoration: none;color: #111111;" href="https://www.facebook.com/hellasdirect?ref=hl" target="">Like</a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><table style="border-collapse: collapse;display:inline;" align="left" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-right:10px; padding-bottom:9px;" valign="top"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;" align="left" valign="middle"><table style="border-collapse: collapse;" align="left" border="0" cellpadding="0" cellspacing="0" width=""><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="middle" width="24"><a style="word-wrap: break-word;" href="https://www.instagram.com/hellasdirect/" target="_blank"><img style="-ms-interpolation-mode: bicubic;display:block;" title="Instagram" alt="Instagram" src="https://www.hellasdirect.gr/wizard//assets/images/for-emails/instagram-dark.png" height="24" width="24"></a></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-left:5px;" align="left" valign="middle"><a style="word-wrap: break-word;font-family: Tahoma, Verdana, Segoe, sans-serif;font-size: 9px;text-decoration: none;color: #111111;" href="https://www.instagram.com/hellasdirect/" target="">Follow</a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><table style="border-collapse: collapse;display:inline;" align="left" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-right:10px; padding-bottom:9px;" valign="top"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;" align="left" valign="middle"><table style="border-collapse: collapse;" align="left" border="0" cellpadding="0" cellspacing="0" width=""><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="middle" width="24"><a style="word-wrap: break-word;" href="https://www.youtube.com/user/hellasdirect" target="_blank"><img style="-ms-interpolation-mode: bicubic;display:block;" title="YouTube" alt="YouTube" src="https://www.hellasdirect.gr/wizard//assets/images/for-emails/youtube-dark.png" height="24" width="24"></a></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-left:5px;" align="left" valign="middle"><a style="word-wrap: break-word;font-family: Tahoma, Verdana, Segoe, sans-serif;font-size: 9px;text-decoration: none;color: #111111;" href="https://www.youtube.com/user/hellasdirect" target="">Watch</a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><table style="border-collapse: collapse;display:inline;" align="left" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-right:0; padding-bottom:9px;" valign="top"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;" align="left" valign="middle"><table style="border-collapse: collapse;" align="left" border="0" cellpadding="0" cellspacing="0" width=""><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="middle" width="24"><a style="word-wrap: break-word;" href="https://twitter.com/HellasDirect" target="_blank"><img style="-ms-interpolation-mode: bicubic;display:block;" title="Twitter" alt="Twitter" src="https://www.hellasdirect.gr/wizard//assets/images/for-emails/twitter-dark.png" height="24" width="24"></a></td><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-left:5px;" align="left" valign="middle"><a style="word-wrap: break-word;font-family: Tahoma, Verdana, Segoe, sans-serif;font-size: 9px;text-decoration: none;color: #111111;" href="https://twitter.com/HellasDirect" target="">Follow</a></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></table></td></tr><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="top"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="600"><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center" valign="top"><table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="600"><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;" valign="top"><table style="border-collapse: collapse;min-width:100%;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding:9px" valign="top"><table style="border-collapse: collapse;min-width:100%;" align="left" width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-right: 9px; padding-left: 9px; padding-top: 0; padding-bottom: 0; text-align:center;" valign="top"></td></tr></tbody></table></td></tr></tbody></table></td></tr></table></td></tr><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-bottom:9px;" valign="top"><table style="border-collapse: collapse;min-width:100%;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:9px;" valign="top"><table style="border-collapse: collapse;max-width:100%; min-width:100%;" align="left" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px;" valign="top"><div style="text-align: left;">
                                                                    © 2020 Hellas Direct. All rights reserved. <br> Έλαβες αυτό το email επειδή πρόσφατα επισκέφθηκες την ιστοσελίδα μας <a style="word-wrap: break-word;" href="https://www.hellasdirect.gr/wizard/">www.hellasdirect.gr</a>.
                                                                </div></td></tr></tbody></table></td></tr></tbody></table></td></tr></table></td></tr></table></center><div style="visibility: hidden; display: none;">
    <img style="-ms-interpolation-mode: bicubic; visibility: hidden; display: none;" width="0" height="0" src="https://www.hellasdirect.gr/email-tracking/KnK6DGjZRmCAcNC0tImqbw"></div>
stsimb commented 3 years ago

schematic

freescout-helpdesk commented 3 years ago

Source code of the email does not contain upper part which means the email you are viewing in Gmail and in FreeScout are different emails. You can check it on the Preview tab of the "Show Original" modal.

2020-11-25_09-41-34

stsimb commented 3 years ago

Thank you very much for your input!

Just now, I was able to verify that the patch I mentioned above (https://github.com/freescout-helpdesk/freescout/issues/882#issuecomment-732971717) fixes the problem ... A customer has sent an email using Huawei and the reply was displayed in freescout.

Could you please consider including it in the next freescout release?

freescout-helpdesk commented 3 years ago

This patch can't fix the issue you've described. Try to remove and try again.

stsimb commented 3 years ago

Maybe my description was not correct, but the patch definitely fixes the display problem we had.

It also makes sense, because it's the exact same string you already have there, just localized to greek.

fulldecent commented 2 years ago

PR sent at https://github.com/freescout-helpdesk/freescout/pull/2319

Recommending to review the PR and to close this issue