Closed stouch closed 2 years ago
Here is the payload i'm currently testing :
It is typically a mail sent from Microsoft outlook.live.com in France.
Je suis intéréssé
is replaced and arrived on my hook like Je suis int �ress �
From: Debug from <test@from.com>
To: "2053d27c-6370-4996-a2a4-09bfa8df5c6c@example.io"
<2053d27c-6370-4996-a2a4-09bfa8df5c6c@example.io>
Subject: RE: TEST
Thread-Topic: TEST
Thread-Index: AQHYhulSipU7FNM+vk2C79M0JiDmAK1cxgla
Date: Thu, 23 Jun 2022 10:15:03 +0000
Message-ID:
<AM7PR02MB62413F36389FB6BB5F9C778ABDB59@AM7PR02MB6241.eurprd02.prod.outlook.com>
References: <b801f1b1-e5e8-49ec-b375-7fbd43104b72@smtp-relay.sendinblue.com>
In-Reply-To: <b801f1b1-e5e8-49ec-b375-7fbd43104b72@smtp-relay.sendinblue.com>
Content-Language: fr-FR
X-MS-Has-Attach:
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator:
X-MS-Exchange-Organization-RecordReviewCfmType: 0
msip_labels:
Content-Type: multipart/alternative;
boundary="_000_AM7PR02MB62413F36389FB6BB5F9C778ABDB59AM7PR02MB6241eurp_"
MIME-Version: 1.0
--_000_AM7PR02MB62413F36389FB6BB5F9C778ABDB59AM7PR02MB6241eurp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Bonjour,
Je suis int=E9ress=E9.
Okay I think I found the reason of this..
In go-smtpsrv
/ parser.go, you ReadAll
the bytes of mail content without considering bytes mapping depending on charset of the mail.
So, for example, instead of :
case contentTypeTextPlain:
newPart, err := decodeContent(part, part.Header.Get("Content-Transfer-Encoding"))
if err != nil {
return textBody, htmlBody, embeddedFiles, err
}
ppContent, err := ioutil.ReadAll(newPart)
We should have :
case contentTypeTextPlain:
newPart, err := decodeContent(part, part.Header.Get("Content-Transfer-Encoding"))
if err != nil {
return textBody, htmlBody, embeddedFiles, err
}
// Depending on part.Header.Get("Content-Type") 's charset :
tr := charmap.Windows1252.NewDecoder().Reader(newPart)
ppContent, err := ioutil.ReadAll(tr)
I'm not enough used to Go programming to help..
Would there anyone who could help me fixing this ?
By the way, the Dockerfile of this project does not work anymore, so I used the perfectly working repo of https://github.com/aranajuan/smtp2http @aranajuan
Thanks
EDIT : I created a pull request in go-smtpsrv
(https://github.com/alash3al/go-smtpsrv/pull/14/commits/a653a0b456054f3458446d2a1c5543fd17775088) to fix this issue. @alash3al
But anyway I can't use smtp2http
right now because the Dockerfile
is deprecated and does not work anymore. Would be really amazing / appreciated to have an update in this repo to get something working 😇
Hi! I don't know i this repo is being maintained. If not feel free to make the PR in my fork, I can push it to dockerhub then :)
Hi! I don't know i this repo is being maintained. If not feel free to make the PR in my fork, I can push it to dockerhub then :)
I pulled your repo to mine, I forked and updated go-smtpsrv to fix the charset issue, and I made some renaming to make it work. It s not amazing but it is working :)
https://github.com/stouch/smtp2http
What do you think ?
Guys, sorry for that so long delay, and thanks for your contributions,
you can do your PRs and I'll merge them ASAP
@alash3al Let's check https://github.com/alash3al/smtp2http/pull/16 to close this issue
Merged successfully
@aranajuan @stouch could you please tell me which use case you use this software for?
Hello,
The mails sent from the french Microsoft outlook and hotmail.com are sent with
Content-Type: text/plain; charset="Windows-1252"
charset.So the payload in hook seems to be badly encoded and the chars and I finally receive are some non-recoverable
�
dead chars.Do you think there is some easy solution to this ?
Thank you so much for your work.