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 480 forks source link

Body of email contains headers if mail Content-Type is "text/plain" #4155

Closed PysX closed 1 month ago

PysX commented 1 month ago

Hello,

This is information about my installation (with docker) PHP version: 8.2.21 FreeScout version: 1.8.147 Database: 10.6.7-MariaDB Are you using CloudFlare: No Are you using non-official modules: No

Since 1.8.40 (i think), some emails are fetched and in the conversation the body contains headers.

I make some tests, and the problem occurs when emails are sended as "text/plain". Emails with content type "text/html" are correctly fetched.

Example of email fetched incorrectly (from "show original" feature) :

BODY :

Return-Path: <mailadm@mydomain.fr><br />
Received: from postman-pat-4.mydomain.net (postman-pat-4.mydomain.net [80.87.xxx.x])<br />
    by postman-pat.mydomain.net (8.13.4/8.15.2) with ESMTP id 46TLUcrK032558<br />
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:30:38 +0200 (CEST)<br />
Received: from localhost (localhost.mydomain.net [127.0.0.1])<br />
    by postman-pat-4.mydomain.net (8.13.8/8.13.8) with ESMTP id 46TLS8GP004680<br />
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:28:08 +0200 (CEST)<br />
Received: from svr236113.mydomain.net (svr236113.mydomain.net [80.87.xxx.xxx])<br />
    by postman-pat-4.mydomain.net (8.13.8/8.13.8) with ESMTP id 46TLS3H5020611<br />
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:28:03 +0200 (CEST)<br />
Received: from myproject.fr (unknown [10.12.xxx.xx])<br />
    by svr236113.mydomain.net (Postfix) with ESMTP id 764D49F6<br />
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:30:32 +0200 (CEST)<br />
Received: from [10.0.xx.x] (helo=localhost)<br />
    by 4a4119be5360 with esmtp (Exim 4.96)<br />
    (envelope-from <ne-pas-repondre@myproject.fr>)<br />
    id 1sYXwu-00Bf4f-11<br />
    for support@myproject.fr;<br />
    Mon, 29 Jul 2024 21:30:32 +0000<br />
Message-ID: <4b55a5b7b0be99f2cdee60af9bdd9d5c@swift.generated><br />
Date: Mon, 29 Jul 2024 23:30:31 +0200<br />
Subject: Mise =?utf-8?Q?=C3=A0?= jour des bornes myproject<br />
From: support@myproject.fr<br />
To: support@myproject.fr<br />
MIME-Version: 1.0<br />
Content-Type: text/plain; charset=utf-8<br />
X-Swift-Return-Path: <ne-pas-repondre@myproject.fr><br />
Content-Transfer-Encoding: 8bit<br />
X-MIME-Autoconverted: from quoted-printable to 8bit by postman-pat.mydomain.net id 46TLUcrK005516<br />
<br />
Bonjour,<br />
<br />
Nous vous informons que les bornes de contrôle XXX n'ont pas été mises à jour depuis 5 jours.<br />
Merci de procéder à leurs mise à jour.<br />
<br />
Cordialement.

But headers are correctly fetched too:

HEADERS:

Return-Path: <mailadm@mydomain.fr>
Received: from postman-pat-4.mydomain.net (postman-pat-4.mydomain.net [80.87.xxx.x])
    by postman-pat.mydomain.net (8.13.4/8.15.2) with ESMTP id 46TLUcrK032558
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:30:38 +0200 (CEST)
Received: from localhost (localhost.mydomain.net [127.0.0.1])
    by postman-pat-4.mydomain.net (8.13.8/8.13.8) with ESMTP id 46TLS8GP004680
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:28:08 +0200 (CEST)
Received: from svr236113.mydomain.net (svr236113.mydomain.net [80.87.xxx.xxx])
    by postman-pat-4.mydomain.net (8.13.8/8.13.8) with ESMTP id 46TLS3H5020611
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:28:03 +0200 (CEST)
Received: from myproject.fr (unknown [10.12.xxx.xx])
    by svr236113.mydomain.net (Postfix) with ESMTP id 764D49F6
    for <support@myproject.fr>; Mon, 29 Jul 2024 23:30:32 +0200 (CEST)
Received: from [10.0.xx.x] (helo=localhost)
    by 4a4119be5360 with esmtp (Exim 4.96)
    (envelope-from <ne-pas-repondre@myproject.fr>)
    id 1sYXwu-00Bf4f-11
    for support@myproject.fr;
    Mon, 29 Jul 2024 21:30:32 +0000
Message-ID: <4b55a5b7b0be99f2cdee60af9bdd9d5c@swift.generated>
Date: Mon, 29 Jul 2024 23:30:31 +0200
Subject: Mise =?utf-8?Q?=C3=A0?= jour des bornes myproject
From: support@myproject.fr
To: support@myproject.fr
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
X-Swift-Return-Path: <ne-pas-repondre@myproject.fr>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by postman-pat.mydomain.net id 46TLUcrK005516
freescout-help commented 1 month ago

Feel free to share EML file of the email or send it to support@freescout.net

PysX commented 1 month ago

eml_files.zip

Hello,

I made zip with two eml files. HTML file is OK (headers separated from Body in freescout), TEXT si KO (Body contains headers in freescout).

Thanks for support,

freescout-help commented 1 month ago

We've checked email_text_ko.eml using php artisan freescout:parse-eml console command and it's being parsed correctly on our FreeScout instance.

Try to place email_text_ko.eml file into /storage/logs/email.eml, run the following console command and send it's output:

php artisan freescout:parse-eml
PysX commented 1 month ago

It seems to be successfully parsed :

[tiredofit/freescout:1.17.79 14:11:06 /www/html] $ php artisan freescout:parse-eml --mailbox=1
Headers:
From mydomain  Wed Jul 31 12:20:16 2024
Return-Path: <mailadm@mydomain.fr>
Received: from obi-wan.mydomain.int [192.168.6.252]
        by debia.sisimai with POP3 (fetchmail-6.3.26)
        for <mydomain@localhost> (single-drop); Wed, 31 Jul 2024 12:20:16 +0200 (CEST)
Received: from postman-pat-4.mydomain.net (postman-pat-4.mydomain.net [80.87.224.8])
        by postman-pat.mydomain.net (8.13.4/8.15.2) with ESMTP id 46VAK3Ic031900
        for <support@myproject.fr>; Wed, 31 Jul 2024 12:20:04 +0200 (CEST)
Received: from localhost (localhost.mydomain.net [127.0.0.1])
        by postman-pat-4.mydomain.net (8.13.8/8.13.8) with ESMTP id 46VAK2iF021361
        for <support@myproject.fr>; Wed, 31 Jul 2024 12:20:02 +0200 (CEST)
Received: from mail.mydomain.com (smtp-in.mydomain.com [80.87.225.4])
        by postman-pat-4.mydomain.net (8.13.8/8.13.8) with ESMTP id 46VAJwBV024068
        for <support@myproject.fr>; Wed, 31 Jul 2024 12:19:58 +0200 (CEST)
Received: from ACTDATAEX02.mydomain.intra (10.2.100.32) by
 smtp-in.mydomain.com (10.1.100.17) with Microsoft SMTP Server (TLS) id
 15.0.1497.32; Wed, 31 Jul 2024 12:19:40 +0200
Received: from ACTDATAEX01.mydomain.intra (10.2.100.31) by
 ACTDATAEX02.mydomain.intra (10.2.100.32) with Microsoft SMTP Server (TLS) id
 15.0.1497.32; Wed, 31 Jul 2024 12:19:58 +0200
Received: from ACTDATAEX01.mydomain.intra ([fe80::3091:42e2:5cbc:ee20]) by
 Actdataex01.mydomain.intra ([fe80::3091:42e2:5cbc:ee20%18]) with mapi id
 15.00.1497.033; Wed, 31 Jul 2024 12:19:58 +0200
From: =?iso-8859-1?Q?C=E9dric_No=EBl?= <cedric.noel@mydomain.com>
To: Support <support@myproject.fr>
Subject: Test au format TEXT
Thread-Topic: Test au format TEXT
Thread-Index: AdrjMyzYjMTrte31Rq2gPdAZBahTHg==
Date: Wed, 31 Jul 2024 10:19:57 +0000
Message-ID: <59ab2610c6d744afbe2caedc2f483ea7@Actdataex01.mydomain.intra>
Accept-Language: fr-FR, en-US
Content-Language: fr-FR
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.1.100.20]
Old-x-esetresult: clean, is OK
Old-x-esetid: 37303A2935BBB651627265
Content-Type: text/plain; charset="iso-8859-1"
MIME-Version: 1.0
X-EsetResult: clean, is OK
X-EsetId: 37303A298BB0B651627265
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by postman-pat.mydomain.net id 46VAK5Ic002855
From:
{"personal":"Cédric Noël","mailbox":"cedric.noel","host":"mydomain.com","mail":"cedric.noel@mydomain.com","full":"Cédric Noël <cedric.noel@mydomain.com>"}
In-Reply-To:

References:
[]
Subject:
Test au format TEXT
Text Body:
ci est un test de message au format TEXT.

__________
Delivery Manager
.
HTML Body:

[tiredofit/freescout:1.17.79 14:11:56 /www/html] $

But this is the result from bot .eml file sended previsously :

Capture d’écran 2024-07-31 141746

Modules: Report, Workflow, Tags, Saved Replies.

freescout-help commented 1 month ago

So it's not quite clear why it happens for you during fetching. Someone may need to debug it on your server.