Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing data in the MessageDeliveryStatus.SatusGroup #253

Closed
Lisaj opened this issue Jun 16, 2016 · 10 comments
Closed

Missing data in the MessageDeliveryStatus.SatusGroup #253

Lisaj opened this issue Jun 16, 2016 · 10 comments
Labels
bug Something isn't working

Comments

@Lisaj
Copy link
Contributor

Lisaj commented Jun 16, 2016

Hello,
I processing MessageDeliveryStatus and I came across a problem that SatusGroup property not contain all data that are in the email.
What I discovered as missing data that is after blank line.
I send a sample email.

Received: from mail.liberec.cz ([93.99.138.133])
        by icewarp.savana.cz (IceWarp 11.2.1.1 RHEL6 x64) with ESMTP (SSL) id 201605122139048777
        for <[email protected]>; Thu, 12 May 2016 21:39:04 +0200
Received: from localhost
    by mail.liberec.cz; Thu, 12 May 2016 21:39:02 +0200
Date: Thu, 12 May 2016 21:39:02 +0200
Message-ID: <[email protected]>
MIME-Version: 1.0
From: Mail Delivery Subsystem <[email protected]>
To: <[email protected]>
Subject: =?utf-8?Q?Zpr=C3=A1vu_nelze_doru=C4=8Dit=3A_Last_Minute_nab?=
    =?utf-8?Q?=C3=ADdka_z=C3=A1jezd=C5=AF_od_CK_Pozn=C3=A1n=C3=AD?=
Content-Type: multipart/report; report-type=delivery-status;
    boundary="MIME-2054893904-22684-delim"
X-Spam-Status: No, hits=0.00 required=5.00 tests= version=3.3.2
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 3.3.2 (1.1) on icewarp.savana.cz

--MIME-2054893904-22684-delim
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit


Toto je informa�ní zpráva automaticky poslaná serverem mail.liberec.cz.

Vaši zprávu 

  Subject: Last Minute nabídka zájezdů od CK Poznání
  Date: Thu, 12 May 2016 19:34:10 +0200



se nepoda�ilo doru�it na následující adresy:

  <[email protected]> (192.168.162.10: Cannot connect to remote host)
--MIME-2054893904-22684-delim
Content-Type: message/delivery-status

Reporting-MTA: dns; mail.liberec.cz
Arrival-Date: Thu, 12 May 2016 19:34:17 +0200

Original-Recipient: [email protected]
Final-Recipient: rfc822;[email protected]
Action: failed
Status: 4.4.1
Remote-MTA: 192.168.162.10
Diagnostic-Code: SMTP; Cannot connect to remote host

--MIME-2054893904-22684-delim
Content-Type: text/rfc822-headers

X-Spam-Status: No, hits=1.0 required=4.0
    tests=AWL: 0.662,BAYES_00: -1.665,FROM_12LTRDOM: 2,
    HTML_IMAGE_ONLY_32: 0.001,HTML_MESSAGE: 0.001,MIME_HTML_ONLY: 0.001,
    TOTAL_SCORE: 1.000,autolearn=no
X-Spam-Level: *
Received: from travelserver.cz ([46.28.109.10])
    by mail.liberec.cz
    for [email protected];
    Thu, 12 May 2016 19:34:17 +0200
Received: from [127.0.0.1] ([127.0.0.1]) by travelserver.cz over TLS secured channel with Microsoft SMTPSVC(8.0.9200.16384);
     Thu, 12 May 2016 19:34:11 +0200
DKIM-Signature: v=1; a=rsa-sha256; d=travelserver.cz; s=travelserver;
    c=relaxed/simple; t=1463074450; h=from:to:subject:date;
    bh=7df5CpNTHM/BX2C+GMdauxK10L6lP02RzqQqI/Zlzr4=;
    b=oT4Us9GqvcY53BSliKmpu1boOF66k99EWf4z4zh9bibP6ieakLhrrRyiViBWdQaiE5z2TxMzZhv
    vaJX1SbqMEYxY24nSyzrRtyED1hYqcmp8scHn4kUbnC/BW156h1C5oCPOKrFnGfKo62vPz/Bm45uW
    HP0Hr/3fagk0grr8K1Y=
From: Newsletter - CK =?iso-8859-1?b?UG96buFu7Q==?=
    <[email protected]>
To: "[email protected]" <[email protected]>
Date: Thu, 12 May 2016 19:34:10 +0200
Subject: Last Minute
 =?utf-8?b?bmFiw61ka2EgesOhamV6ZMWvIG9kIENLIFBvem7DoW7DrQ==?=
Message-Id: <KR7PFDZH6YT4.SQ99J6VJJOK22@vm9141>
MIME-Version: 1.0
Disposition-Notification-To: [email protected]
NewsletterContactKey: b9369c54-51ee-4915-a5ae-a289ebb7b72b
Content-Type: text/html; charset=utf-8
Content-Id: <KR7PFDZH6YT4.5MI18KP4X33T@vm9141>
Content-Transfer-Encoding: quoted-printable
Return-Path: [email protected]
X-OriginalArrivalTime: 12 May 2016 17:34:11.0789 (UTC) FILETIME=[7F084FD0:01D1AC74]

--MIME-2054893904-22684-delim--

@jstedfast jstedfast added the question A question about how to do something label Jun 16, 2016
@jstedfast
Copy link
Owner

There should not be a blank line. That's a bug in the sending software.

You'll have to parse the MessageDeliveryStatus content yourself if you want to get access to that.

@Lisaj
Copy link
Contributor Author

Lisaj commented Jun 16, 2016

Hello,
thank you for the quick reply.

I have one more question. It is a MessageDispositionNotification which does not contain data in the Fields property. There is no newline.
There is also an error in the email?

Delivered-To: [email protected]
Received: by 10.200.42.249 with SMTP id c54csp1670004qta;
        Wed, 15 Jun 2016 05:21:21 -0700 (PDT)
X-Received: by 10.28.111.215 with SMTP id c84mr11012566wmi.21.1465993281501;
        Wed, 15 Jun 2016 05:21:21 -0700 (PDT)
Return-Path: <[email protected]>
Received: from smtp1.seznam.cz (smtp1.seznam.cz. [2a02:598:a::78:43])
        by mx.google.com with ESMTPS id o5si10422013wmo.91.2016.06.15.05.21.21
        for <[email protected]>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 15 Jun 2016 05:21:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates 2a02:598:a::78:43 as permitted sender) client-ip=2a02:598:a::78:43;
Authentication-Results: mx.google.com;
       dkim=pass (test mode) [email protected];
       spf=pass (google.com: domain of [email protected] designates 2a02:598:a::78:43 as permitted sender) [email protected];
       dmarc=pass (p=NONE dis=NONE) header.from=seznam.cz
Received: from email.seznam.cz
    by email-smtpc9b.ko.seznam.cz (email-smtpc9b.ko.seznam.cz [10.53.14.15])
    id 7ec0ae91aa4bd32e7a91f072;
    Wed, 15 Jun 2016 14:21:20 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=beta;
    t=1465993280; bh=lQKXiloPWAyk8v5TLd2ZInwzwCXh2Mbp6EdCAPOcJCE=;
    h=From:To:Subject:Date:Message-Id:References:Mime-Version:X-Mailer:
     Content-Type;
    b=UGYI8aYGuotYJEjKCADcfAymVBgaf0r+iKx9Xp+3JsDAuz7a/l7ywpU2ieaS+sGnQ
     Ca+BrhW242vweIF8LM90TAECGGzjkmE1nZYM9sHZthPeyQZ8jdfrYSkOulapA/JcDB
     /UoIVuCwPPPzFj+LPpowTFgpjZuLSPbhzRvZm9ek=
From: <[email protected]>
To: <[email protected]>
Subject: =?utf-8?q?P=C5=99e=C4=8Dteno=3A_test?=
Date: Wed, 15 Jun 2016 14:21:20 +0200 (CEST)
Message-Id: <[email protected]>
References: <8e7d1962-312d-4e37-b72e-48b321429b6d>
Mime-Version: 1.0 (szn-mime-2.0.10)
X-Mailer: szn-ebox-4.5.139
Content-Type: multipart/report;
    boundary="=_6b289f9c1d16f7c024e98400=8ce99ebe-3b9e-5774-83bd-c53b2f16df3b_=";
    report-type=disposition-notification

--=_6b289f9c1d16f7c024e98400=8ce99ebe-3b9e-5774-83bd-c53b2f16df3b_=
Content-Type: text/html;
    charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"=0A=
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">=0A=
=0A=
<html xmlns=3D"http://www.w3.org/1999/xhtml">=0A=
=0A=
<head>=0A=
    <title>[Seznam.cz] </title>=0A=
    <meta http-equiv=3D"content-type" content=3D"text/html;charset=3Dutf-8=
"/>=0A=
</head>=0A=
=0A=
<body>=0A=
=0A=
<p>=0A=
Komu: [email protected] &lt;[email protected]&gt;=0A=
</p>=0A=
<p>=0A=
P=C5=99edm=C4=9Bt: test=0A=
</p>=0A=
<p>=0A=
Odesl=C3=A1no: 15.6.2016 11:49:01=0A=
</p>=0A=
<p>=0A=
byla p=C5=99e=C4=8Dtena: 15.6.2016 14:21:20=0A=
</p>=0A=
=0A=
</body>=0A=
</html>=0A=
=0A=
--=_6b289f9c1d16f7c024e98400=8ce99ebe-3b9e-5774-83bd-c53b2f16df3b_=
Content-Type: message/disposition-notification

Disposition: manual-action/mdn-sent-manually; displayed
Final-Recipient: rfc822; [email protected]
Original-Message-Id: <8e7d1962-312d-4e37-b72e-48b321429b6d>
--=_6b289f9c1d16f7c024e98400=8ce99ebe-3b9e-5774-83bd-c53b2f16df3b_=--

@jstedfast
Copy link
Owner

jstedfast commented Jun 16, 2016

Yes, there should be a blank line after the last key/value pair, but there isn't.

I've already worked around that particular bug in this commit: ff223fb

@jstedfast
Copy link
Owner

Actually, reopening this since the first bug you reported is actually a bug, I got confused between message/delivery-status and message/disposition-notification.

delivery status messages have multiple header groups.

@jstedfast jstedfast reopened this Jun 16, 2016
@Lisaj
Copy link
Contributor Author

Lisaj commented Jun 16, 2016

Befor commit ff223fb throws "Failed to parse headers." Now is empty Fields.

@jstedfast
Copy link
Owner

Seems to work fine for me with your test message:

using System;
using System.IO;
using System.Linq;
using System.Text;

using MimeKit;

namespace TestCase
{
    class Program
    {
        static void Main (string[] args)
        {
            var message = MimeMessage.Load (args[0]);
            var mdn = message.BodyParts.OfType<MessageDispositionNotification> ().FirstOrDefault ();

            foreach (var header in mdn.Fields) {
                Console.WriteLine ("{0}: {1}", header.Field, header.Value);
            }
        }
    }
}

output is:

Disposition: manual-action/mdn-sent-manually; displayed
Final-Recipient: rfc822; [email protected]
Original-Message-Id: <8e7d1962-312d-4e37-b72e-48b321429b6d>

Try with the latest commit.

@jstedfast jstedfast added bug Something isn't working and removed question A question about how to do something labels Jun 16, 2016
@Lisaj
Copy link
Contributor Author

Lisaj commented Jun 16, 2016

Thanks with current version of the master everything works.

@jstedfast
Copy link
Owner

Awesome :)

@jstedfast
Copy link
Owner

FWIW, I'll try to release a new version within the next few days.

@jstedfast
Copy link
Owner

I have published a new version of MimeKit that fixes this issue to nuget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants