jeudi 9 février 2017

Setting the body of a mimemessage removes other details

Vote count: 0

Leading on from my previous question, if I set the body of a MimeMessage the attachments, bodyparts, from and all the details are removed. How can I get around this?

foreach (MimeKit.MimeEntity bodyPart in tnefMessage.BodyParts)
{
    if (!bodyPart.IsAttachment)
    {
        using (MemoryStream ms = new MemoryStream())
        {
            bodyPart.WriteTo(ms);

            ms.Flush();
            ms.Position = 0;
            using (StreamReader sr = new StreamReader(ms))
            {
                sr.ReadLine();
                sr.ReadLine();

                tnefMessage.Body = new MimeKit.TextPart("plain")
                {
                    Text = RTFToText(sr.ReadToEnd())
                };
            }
        }
    }
}

asked 49 secs ago

Let's block ads! (Why?)



Setting the body of a mimemessage removes other details

Aucun commentaire:

Enregistrer un commentaire