Git Product home page Git Product logo

Comments (8)

jordan-wright avatar jordan-wright commented on August 15, 2024

Reference

Tentatively, I think this is caused by either improper handling of header folding (as defined by RFC 2822), or improper folding on the client library's part.

I'll generate some test cases out of the data from the log.

from email.

kalbasit avatar kalbasit commented on August 15, 2024

Relevant emails:

For 2015/10/19 17:37:01 error reading "/offlineimap/data/mail/personal/cur/1442985259_1.1.f6acde6ceb6b,U=47211,FMD5=0be5a6c82893ecaa8bb29bd36831e457:2,S": malformed MIME header line: charset="utf-8":

X-Account-Key: account3
X-UIDL: f5ebc70c-b391-4193-a071-f8883fe412c2
X-Mozilla-Keys:                                                                                 
X-WebMail: true
X-Folder: INBOX
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0wO0Q9MjtTQ0w9Ng==
X-Message-Status: n:0
X-SID-PRA: annuaire-perpetuel.biz <[email protected]>
X-Message-Info: 6sSXyD95QpUfFTyQV1peZqtij3RhPybMpAqWg3jbN+K+iOeTPYtdTKwCVvvOvZypTVlcjYGryOGIX5BykUuQpcnTpB23DC46
Received: from ks369149.kimsufi.com ([94.23.42.17]) by col0-mc4-f36.Col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959);
     Sun, 12 Jul 2009 11:26:18 -0700
Received: by ks369149.kimsufi.com (Postfix, from userid 48)
    id 3F37636BA9; Sun, 12 Jul 2009 20:26:04 +0200 (CEST)
To: [email protected]
Subject: 10 annuaires pour votre prospection commercial pour wael_nasreddine
Reply-to: annuaire-perpetuel.biz <[email protected]>
From: annuaire-perpetuel.biz <[email protected]>
X-Sender: <annuaire-perpetuel.biz>
X-Mailer: PHP
X-auth-smtp-user: annuaire-perpetuel.biz <[email protected]> 
X-abuse-contact:abuse annuaire-perpetuel.biz 
Date: Sun, 12 Jul 2009 20:26:04 +0200
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="_----------=_parties_01b4ef554aa6bb67c2474dccdb9aee12"
Message-Id: <[email protected]>
Return-Path: [email protected]
X-OriginalArrivalTime: 12 Jul 2009 18:26:18.0551 (UTC) FILETIME=[3FAA5470:01CA031E]
X-Keywords: Hotmail

--_----------=_parties_01b4ef554aa6bb67c2474dccdb9aee12
Content-Type: text/plain
charset="utf-8"
Content-Transfer-Encoding: 8bit

Bonjour,


Pour developper votre activite, vous avez besoin de trouver de nouveaux clients. Líannuaire-perpetuel vous permet de constituer votre base de donnees prospectives facilement, rapidement et a moindre cout.

Líannuaire perpetuel est un logiciel qui capture dans líannuaire universel* francais ou dans 6 autres annuaires les coordonnees de toutes les entreprises de France, des associations, des professions liberales, des artisans...

Cíest facile, il suffit de choisir líannuaire, la categorie et le logiciel va creer votre fichier de prospect.

Cíest complet, puisque vous disposez de toutes les informations commerciales utiles : nom, adresse, telephone, fax, email...

Cíest efficace, car les coordonnees de vos clients sont mises a jour a chaque action commerciale.

Cíest bon marche, car vous níavez pas de mise a jour ou díabonnement a payer tous les ans ou tous les semestres.

Retrouvez le descriptif complet de notre logiciel sur www.annuaire-perpetuel.biz


Elise Estorez



Ps : pour ne plus recevoir díinformation de notre part, cliquez sur www.annuaire-perpetuel.biz/scripts/desinscrire.php?client=wael_nasreddine*hotmail.com&sourcemail=riouyhvkugbq


--_----------=_parties_01b4ef554aa6bb67c2474dccdb9aee12
Content-Type: text/html; charset="utf-8"; Content-Transfer-Encoding: 8bit;

<p>Bonjour,
<p> </p>

<p>Pour d&eacute;velopper votre activit&eacute;, vous avez besoin de trouver de nouveaux clients. L&rsquo;annuaire-perp&eacute;tuel vous permet de constituer votre base de donn&eacute;es prospectives facilement, rapidement et &agrave; moindre cout.</p>
<p> </p>
<p>L&rsquo;annuaire perp&eacute;tuel est <span style="color:#0000FF;"><strong>un logiciel qui capture dans l&rsquo;annuaire</strong></span> universel* fran&ccedil;ais ou dans 6 autres annuaires <span style="color:#0000FF;"><strong>les coordonn&eacute;es de toutes les entreprises de France</strong></span>, des associations, des professions lib&eacute;rales, des artisans...</p>
<p> </p>
<p><strong><span style="color:#FF0000;">C&rsquo;est facile,</span></strong> il suffit de choisir l&rsquo;annuaire, la cat&eacute;gorie et le logiciel va cr&eacute;er votre fichier de prospect.</p>
<p> </p>
<p><strong><span style="color:#FF0000;">C&rsquo;est complet,</span></strong> puisque vous disposez de toutes les informations commerciales utiles : nom, adresse, t&eacute;l&eacute;phone, fax, email...</p>
<p> </p>
<p><strong><span style="color:#FF0000;">C&rsquo;est efficace,</span></strong> car les coordonn&eacute;es de vos clients sont mises &agrave; jour &agrave; chaque action commerciale.</p>
<p> </p>
<p><strong><span style="color:#FF0000;">C&rsquo;est bon march&eacute;,</span></strong> car vous n&rsquo;avez pas de mise &agrave; jour ou d&rsquo;abonnement &agrave; payer tous les ans ou tous les semestres.</p>
<p> </p>
<p>Retrouvez le descriptif complet de notre logiciel sur <a href="http://www.annuaire-perpetuel.biz/?utm_source=message5&utm_medium=email&utm_content=annuaire-perpetuel.biz&utm_campaign=lws">www.annuaire-perpetuel.biz </a>.</p>
<p> </p>
<p>Elise Estorez</p>
<p> </p>
<p> </p>
<p><span style="font-size: small; ">Ps : pour ne plus recevoir d&rsquo;information de notre part, cliquez sur <a href= "http://annuaire-perpetuel.biz/scripts/desinscrire.php?client=wael_nasreddine*hotmail.com&sourcemail=riouyhvkugbq"> ce lien </a>  ou rendez-vous sur la page newsletter du site.</span></p>

--_----------=_parties_01b4ef554aa6bb67c2474dccdb9aee12--

For 2015/10/19 17:37:01 error reading "/offlineimap/data/mail/personal/cur/1442985303_0.1.f6acde6ceb6b,U=47308,FMD5=0be5a6c82893ecaa8bb29bd36831e457:2,S": malformed MIME header line: Amin Kobeissy has invited you to Desktopdating:

X-Account-Key: account3
X-UIDL: 6216e186-63b4-4ebd-85ee-6d0708a4b436
X-Mozilla-Keys:                                                                                 
X-WebMail: true
X-Folder: INBOX
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtTQ0w9MA==
X-Message-Status: n:0
X-SID-PRA: [email protected]
X-Message-Info: JGTYoYF78jHWFMHv7lJ6PRb6qgf+kkqOfqX8FHmFc6vxWCWMxtfpgAqTSlYTgChnc2SDFQ888p5wK1DrlQQCrU/c5gnYbPV6
Received: from mta1.desktopdating.net ([209.190.88.6]) by col0-mc1-f34.Col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959);
     Tue, 16 Jun 2009 00:44:03 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; s=pmta; d=desktopdating.net;
 h=Sender:MIME-Version:Content-Type:To:From:Subject:Message-ID:Date; [email protected];
 bh=1u4BBzvjy5racA1rj29IsakUBg8=;
 b=roegVpMedSIrPPqrUHAD/PMRZu3FfXP3p2kgg73yIfr4gLtjs4QpQQNEQUm+ZPov6BU/FufKI5gG
   ZNDj9pZMQD6VMbZYh84tppXQUzU4ENZ117vceNz0UYrio3mNun2m+fIiXDzsBykqsi7Tsya5qznI
   /BKH53RXy2KLE8v9KeI=
DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=pmta; d=desktopdating.net;
 b=RGlt6s7HiSotwEjNlRhwGWUERkiRbcdC9nltYTsWyxBwwCyPivS8aPaD8iapKTK+EJe5qWPRMgbT
   eCSeAfDhI7M9bxZXOUJfx1WAdoA87XQHU/XdLTtr2jVyQ4R5OnZCltV0a14H/ZRHovxfMiXJ6oB2
   05+Yc0Cq18ZmaARRyTQ=;
Received: by mta1.desktopdating.net id h6t6k60mingt for <[email protected]>; Tue, 16 Jun 2009 03:43:48 -0400 (envelope-from <[email protected]>)
X-Priority: 3
X-Mailer: PHPMailer [version 1.72]
X-UNSUBSCRIBE: 3sXK38ri0OPWxtjN19XJpdva6NzRzc2izN3UkJejpKKgqZSPrKGcnZCXo5utnKCajqWfmsuRzuHh3ePVkJKimZqUlZGknQ==
Sender: [email protected]
Errors-To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_edefd608547d93c591ff4e78837bf02f"
To: "[email protected]" <[email protected]>
From: Amin Kobeissy <[email protected]>
Subject: Amin Kobeissy has sent you a Desktopdating invitation
Message-ID: <[email protected]>
Date: Tue, 16 Jun 2009 03:43:48 -0400
Return-Path: [email protected]
X-OriginalArrivalTime: 16 Jun 2009 07:44:03.0466 (UTC) FILETIME=[38397EA0:01C9EE56]
X-Keywords: Hotmail

--b1_edefd608547d93c591ff4e78837bf02f
Content-Type: text/plain; charset = "iso-8859-1"
Content-Transfer-Encoding: 8bit
Amin Kobeissy has invited you to Desktopdating

aminkobeissy wants to be your friend

aminkobeissy

Do you want to add aminkobeissy to your friends network ?

Accept http://invite.desktopdating.net/invite.php?3sXK34vi0OPWxtjN19XJ45bp69DV0MDiyuHZycnX1OLUsMzQ6NbP0NCT1trh7ZPiouHS3Iev1NXQ3eLj3d+X58/UzdPe2tbU2dfU7anW1tjS1NTgndPTzvKM7JmUlayYpKWdlZc=

Reject http://invite.desktopdating.net/invite.php?3sXK34vi0OPWxtjN19XJ45bp69DV0MDiyuHZycnX1OLUsMzQ6NbP0NCT1trh7ZPiouHS3Iev1NXQ3eLj3d+X58/UzdPe2tbU2dfU7anW1tjS1NTgndPTzvKM7JmUlayYpKWdlZc=

Privacy Policy http://www.desktopdating.net/_themes/main/new_age/popup/priv_policy.html
Unsubscribe http://invite.desktopdating.net/unsubscribe.php?3sXK38ri0OPWxtjN19XJpdva6NzRzc2izN3UkJejpKKgqZSPrKGcnZCXo5utnKCajqWfmsuRzuHh3ePVkJKimZqUlZGknQ==
Terms and Conditions http://www.desktopdating.net/_themes/main/new_age/popup/term_cond.html
--b1_edefd608547d93c591ff4e78837bf02f
Content-Type: text/html; charset = "iso-8859-1"
Content-Transfer-Encoding: 8bit


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>aminkobeissy wants to be your friend</title>
<style>
<!--
 .tMail { font-family: Verdana; font-size: 8pt; color: #333333; background-color:
#D3E7F7; text-align:right; padding-left:1px; padding-right:5px; padding-top:2px; padding-bottom:2px}
 .tAccept { font-family: Arial; font-size: 8pt; color: #808080 }
 .tChoice { font-family: Arial; font-size: 10pt; color: #333333; font-weight: bold; background-color:#FFFFFF }
 .tFooter { color: #808080; font-family: Verdana; font-size: 8pt; background-color:#FFFFFF }
 .tFriend { font-family: Arial; font-size: 12pt; font-weight: bold }
 .hPrefs { font-family: Verdana; font-size: 8pt; color: #255ED1; }
 .tblUserInfo{ border:1px dotted #C0C0C0; font-family: Verdana; font-size: 8pt; color: #333333; background-color:#FFFFFF}
 .tblAddFriendBlock{border: 1px solid #808080; padding-left: 4px; padding-right: 4px;
padding-top: 1px; padding-bottom: 1px; background-color:#FFFFFF}
 .tFooter { font-family: Arial; font-size: 8pt; color: #333333; }
 .tFooterPromo { font-family: Arial; font-size: 8pt; color: #808080; }
 .hFooter { font-family: Arial; font-size: 8pt; color: #255ED1; }
-->
</style>
</head>
<body topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" marginheight="0" marginwidth="0" background="http://staticcache.desktopdating.net/images/afrbg.gif"><br>
<div align="center">
<table width="500" id="tblAddFriendBlock" class="tblAddFriendBlock">
<tr>
<td width="133">
<img border="0" src="http://invite.desktopdating.net/clickhere.png?[Mailopen_string" alt="Add Friend Request from Desktopdating.net for aminkobeissy" width="122" height="56"></td>
<td align="center" class="tFriend">
Amin Kobeissy wants to be your friend</td></tr>
<tr>
<td align="center" valign="top" colspan="2">
<hr noshade color="#C0C0C0" size="1" style="padding: 0">
</td>
</tr>
<tr>
<td width="133" align="center" valign="top">
<table border="0" id="tblUserInfo" class="tbluserInfo">
<tr><td align="center"><b><font size="2">aminkobeissy</font></b></td></tr>
<tr>
<td align="center"><img src="http://staticcache.desktopdating.net/images/no_photo.jpg" title="View aminkobeissy's  profile" width="64" height="64"></td>
</tr>
</table>
</td>
<td align="center" class="tChoice">
Do you want to add Amin Kobeissy to your friends network ?<br>
 <table border="0" id="table1" class="tAccept">
<tr>
<td align="center"><a href="http://invite.desktopdating.net/invite.php?3sXK34vi0OPWxtjN19XJ45bp69DV0MDiyuHZycnX1OLUsMzQ6NbP0NCT1trh7ZPiouHS3Iev1NXQ3eLj3d+X58/UzdPe2tbU2dfU7anW1tjS1NTgndPTzvKM7JmUlayYpKWdlZc=">
<img src="http://staticcache.desktopdating.net/images/af_yes.jpg" border="0" alt="Click here to accept aminkobeissy as a friend" width="109" height="48"></a><br>
<a class="hPrefs" href="http://invite.desktopdating.net/invite.php?3sXK34vi0OPWxtjN19XJ45bp69DV0MDiyuHZycnX1OLUsMzQ6NbP0NCT1trh7ZPiouHS3Iev1NXQ3eLj3d+X58/UzdPe2tbU2dfU7anW1tjS1NTgndPTzvKM7JmUlayYpKWdlZc=">Accept</a></td>
<td>  </td>
<td align="center"><a href="http://invite.desktopdating.net/invite.php?3sXK34vi0OPWxtjN19XJ45bp69DV0MDiyuHZycnX1OLUsMzQ6NbP0NCT1trh7ZPiouHS3Iev1NXQ3eLj3d+X58/UzdPe2tbU2dfU7anW1tjS1NTgndPTzvKM7JmUlayYpKWdlZc=">
<img src="http://staticcache.desktopdating.net/images/af_no.jpg" border="0" alt="Click here to reject friend request" width="109" height="48"></a><br>
<a class="hPrefs" href="http://invite.desktopdating.net/invite.php?3sXK34vi0OPWxtjN19XJ45bp69DV0MDiyuHZycnX1OLUsMzQ6NbP0NCT1trh7ZPiouHS3Iev1NXQ3eLj3d+X58/UzdPe2tbU2dfU7anW1tjS1NTgndPTzvKM7JmUlayYpKWdlZc=">Reject</a></td>
</tr>
</table>
</td></tr>
</table>
</div>
<table align="center" class="tFooterPromo"><tr>
<td align="center" valign="top" colspan="2" class="tFooterPromo">
<a class="hFooter" href="http://www.desktopdating.net/_themes/main/new_age/popup/priv_policy.html">Privacy Policy</a> 
<a class="hFooter" href="http://invite.desktopdating.net/unsubscribe.php?3sXK38ri0OPWxtjN19XJpdva6NzRzc2izN3UkJejpKKgqZSPrKGcnZCXo5utnKCajqWfmsuRzuHh3ePVkJKimZqUlZGknQ==">Unsubscribe</a> 
<a class="hFooter" href="http://www.desktopdating.net/_themes/main/new_age/popup/term_cond.html">Terms and Conditions</a></td>
</tr></table>
</body>
</html>
--b1_edefd608547d93c591ff4e78837bf02f--

from email.

kalbasit avatar kalbasit commented on August 15, 2024

@jordan-wright is this good enough?

from email.

jordan-wright avatar jordan-wright commented on August 15, 2024

Hey @kalbasit, this is great. Thanks! I think I hit the nail on the head with header folding being the cause. It seems like this is related to the code in net/textproto here.

In the first email, you'll notice that the Content-Type header is folded before "utf-8". RFC 2822 specifies that, if a header is to be folded, the CRLF should occur before a whitespace character. It looks like the stdlib enforces this.

The good news is that we can figure it out and adjust. The bad news is that we might have to deviate from the stdlib if it is indeed a bug with their implementation (or if it isn't a bug and we just want to go in a more flexible direction).

The second one is a bit trickier. It looks like there just isn't a blank line between the headers and the body. I'll need to review the RFC more to determine if it's a bug, and what we can do about it. For example, even if we just search for a ":" in the line to determine if it's a header or not, that would catch things like "Dear @jordan-wright:", etc. I'll be thinking about this one.

Thanks for the report!

from email.

kalbasit avatar kalbasit commented on August 15, 2024

Perhaps we should not deviate from the stdlib for most email but maybe we could special parse emails that stdlib fails to parse. if we get an error from textproto.ReadMIMEHeader() we could try to parse it ourselves. Not sure if we could smash the utf-8 back one line or simply ignore it.

I'm not opposed to do go on a different route where instead of trying to parse malformed emails, we could try to write a different library that reads an malformed email, fixes it (pre-defined rules I guess) and then writes it out renewed. I'm not sure if offlineimap handles such changes to email files but it could be a better solution overall. It'd be up to the binary using this library to fix the email, writes it down on file and try again.

from email.

jordan-wright avatar jordan-wright commented on August 15, 2024

if we get an error from textproto.ReadMIMEHeader() we could try to parse it ourselves.

We could try to do this, but unfortunately the only solution I see is to completely re-implement textproto.ReadMIMEHeader(), since we don't know where the process failed. The entire function returns an error and doesn't give much context.

I'm not opposed to do go on a different route where instead of trying to parse malformed emails, we could try to write a different library that reads an malformed email, fixes it (pre-defined rules I guess) and then writes it out renewed.

This isn't a bad idea. I could see this being a bit more flexible in the long term.

For now, let me go read through all the RFC's to see authoritatively what they say about this kind of stuff. At the very least, I'll mention it to the Golang devs if they are, in fact, somehow not enforcing the same flexibility requested by the RFC.

from email.

kalbasit avatar kalbasit commented on August 15, 2024

If we go with the "fix-malformed-emails" solution, what's your ETA on closing down the issues?

from email.

rajdeol avatar rajdeol commented on August 15, 2024

hey @jordan-wright how is the progress on this one, I am having the same issue and looking forward for a fix

from email.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.