I’m again having an issue with a legacy application.
Creating an E-Mail using this code:
var b = new MailBuilder {Subject = "Hallo"};
b.From.Add(new MailBox("dagobert.duck@entenhausen.at"));
b.To.Add(new MailBox("donald.duck@entenhausen.at"));
b.AddAttachment(Encoding.UTF8.GetBytes("hello world"));
var mail = b.Create();
results in the following EML:
Content-Type: multipart/mixed;
boundary="----=_NextPart_46379612.848537642257"
MIME-Version: 1.0
Subject: Hallo
From: <dagobert.duck@entenhausen.at>
To: <donald.duck@entenhausen.at>
Date: Tue, 18 Nov 2014 10:38:35 +0100
Message-ID: <2f796a56-32a7-4f41-b1f1-5bc881842479@mail.dll>
------=_NextPart_46379612.848537642257
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: 7bit
------=_NextPart_46379612.848537642257
Content-Type: application/octet-stream
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment
hello world
------=_NextPart_46379612.848537642257--
The problem is the empty Mime Part that was created for the empty body. Is there a way to create that mail without the empty mime part, so that the resulting mail looks like this:
Content-Type: multipart/mixed;
boundary="----=_NextPart_46379612.848537642257"
MIME-Version: 1.0
Subject: Hallo
From: <dagobert.duck@entenhausen.at>
To: <donald.duck@entenhausen.at>
Date: Tue, 18 Nov 2014 10:38:35 +0100
Message-ID: <2f796a56-32a7-4f41-b1f1-5bc881842479@mail.dll>
------=_NextPart_46379612.848537642257
Content-Type: application/octet-stream
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment
hello world
------=_NextPart_46379612.848537642257--
Thanks and best regards