We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Not Saving attachments properly

Hello

I am trying to add the message as attachment to itself and save it as an .eml

I am loading it as an MapiMessage, then converting it to mailmessage

Here is the sample code that is not working.
var m = MapiMessage.Load(…);
var temp = m.Copy();
temp.Attachments.Add(m.Subject+ “.msg”, m);
var mail = temp.ToMailMessage(new MailConversionOptions())
mail.save(…, new EmlSaveOptions())

The above code is not working, however if we use the overloading of Attachments.Add() method it will work like this
(using MemoryStream stream = new MemoryStream()){
m.Save(stream, new MsgSaveOptions());
temp.attachments.Add(m.Subject+".msg",stream.toArray())
}

Is this bug, or the way it should work?

Below I will attach sample input message(.msg) and corrupted output(.emlDS_[Kotak] Economy The missing tax filers - Copy.zip (811.3 KB)
)

@AWANGIKAR

We have tested the scenario using the latest version of Aspose.Email for .NET 22.3 with following code example and have not found the shared issue. So, please use Aspose.Email for .NET 22.3.

MailMessage message = MailMessage.Load(MyDir + "176928152.eml");

message.AddAttachment(new Attachment(MyDir  + "DS_[Kotak] Economy The missing tax filers - Copy.msg"));
message.Save(MyDir + "out.eml", Aspose.Email.SaveOptions.DefaultEml);