ReplyMessageBuilder.buildresponse fails while building a response if attachments are present

ReplyMessageBuilder.buildresponse fails while building a response if attachments are present, even when AdditionMode is set to attachment.

CODE

ReplyMessageBuilder builder = new ReplyMessageBuilder();
builder.ReplyAll = true;
builder.AdditionMode = OriginalMessageAdditionMode.Textpart;
builder.AdditionMode = OriginalMessageAdditionMode.Attachment;

MapiMessage replyMsg = builder.BuildResponse(MapiMessage.FromStream(new MemoryStream(objFileData))); Code Breaks at this point

STACKTRACE
at System.Text.Encoding.GetBytes(String s)
at Aspose.Email.ReplyMessageBuilder.BuildResponse(MapiMessage msg)
at Attachedfile.LoadExemptionMessage(Int64 exemptionId, Int32 memoId, Int32 msgMode) in c:\DMS\PROJECTS\DMS-MAY2020\Development\IBCWeb\DealManagement\Attachedfile.aspx.cs:line 255

Exception: String reference not set to an instance of a String. Parameter Name: s

@bhasinamit,

I have observed the issue shared by you and suggest you to please try using latest Aspose.Email for .NET 20.3 on your end. In case you still observe the issue then please share the working sample code along with source file reproducing the issue.

The Aspose.Email upgrade to version 20.3 is not working . The behavior is the same, looks like this issue is not fixed in this version as well. I hope the Aspose team has an answer to this problem.

Here the basic code that should work for the reply message builder.

ReplyMessageBuilder builder = new ReplyMessageBuilder();
builder.ReplyAll = true;
builder.AdditionMode = OriginalMessageAdditionMode.Textpart;

objFileData is the message stored as Byte[]
MapiMessage replyMsg = builder.BuildResponse(MapiMessage.FromStream(new MemoryStream(objFileData))); - CODE FAILS HERE

@bhasinamit,

I have observed the issue and have created an issue with ID EMAILNET-39790 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

However, as requested earlier that without the source file data we will not be able to help you. So, please share sample data “objFileData” - in your code. You can save this data in MAPI message and send this message to us, like this:

MapiMessage sourceMsg = MapiMessage.FromStream(new MemoryStream(objFileData));
sourceMsg .Save("samplefile.msg");
MapiMessage replyMsg = builder.BuildResponse(sourceMsg);

we need “samplefile.msg”

The issues you have found earlier (filed as EMAILNET-39790) have been fixed in this update.