Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

Error when saving MailMessage with SaveOptions.DefaultHtml -

$
0
0
While writing some unit tests for my code and I ran across an issue. I am not exactly sure if this is true bug or if I am doing something wrong.


[TestMethod()]
public void SaveMessageAsHtmlTestWithAsposeOnly()
{
var mailMessage = new Aspose.Email.Mail.MailMessage();
mailMessage.Date = DateTime.Now;
mailMessage.HtmlBody = "This is junk";
mailMessage.Attachments.Add(new Attachment("test.pdf"));
mailMessage.Save("SaveMessageAsHtmlTest.html",SaveOptions.DefaultHtml);
}

but if fails with this error.

System.InvalidCastException: Unable to cast object of type 'System.IO.FileStream' to type 'System.IO.MemoryStream'.

This same test passes if I save it as other types, am I doing something wrong. I would not expect to get an exception ?

Viewing all articles
Browse latest Browse all 1367

Trending Articles