"The reply to address is not in a recognized format"

hello aspose community,

we are converting items from EWS (Exchange Web Services) to MSG with this code:
MimeContent mimeContent = item.getMimeContent();
InputStream inputStream = new ByteArrayInputStream(mimeContent.getContent());
MailMessage mailMessage = MailMessage.load(inputStream);
mailMessage.save(targetFile.getAbsolutePath(), MailMessageSaveType.getOutlookMessageFormat());

For some items, this fails due to (aspose2 and aspose17):
Caused by: com.aspose.email.ms.System.IllegalArgumentException: The reply to address is not in a recognized format.
at com.aspose.email.MapiMessage.(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MapiMessage.a(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MapiMessage.d(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MapiMessage.b(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MapiMessage.fromMailMessage(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MapiMessage.fromMailMessage(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MailMessage.a(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MailMessage.save(Unknown Source) ~[xchtool.jar:na]
at com.aspose.email.MailMessage.save(Unknown Source) ~[xchtool.jar:na]
at com.recommind.msxtool.util.Exchange.saveItem(Exchange.java:581) ~[xchtool.jar:na]
… 9 common frames omitted

I know I can validate (Programming Email Verification|Documentation)
beforehand, but I would like to get the msg for this item, even if Reply-To: is broken.

Can this be fixed or is there a workaround (like removing Reply-To: before conversion)?
(we tried many things for removing Reply-To:, but didn’t succeed).

Many Thanks and Best Regards,


Could you please share with us if you are using the latest version of the API i.e. Aspose.Email for .NET 17.10? If you are still facing issue, please share your sample EML file with us for further investigation at our end. For removing a header, you can use the Remove method of headers collection using MailMessage.

MailMessage eml = MailMessage.Load("Reply-To.msg", new MsgLoadOptions());


bool b = eml.Headers.Remove("Reply-To");

hello Kashif,

[I am using the Java bindings]

I tried this:
LOGGER.debug(“reply-to: {}”, mailMessage.getHeaders().get(“Reply-To”));

The first line results in “reply-to: null”. The second line seems to have no impact, I still get the above
exception. Is there another workaround?
I cannot provide sample data because this is confidential customer data.

Many Thanks and Best Regards,

hello Kashif,

I also tried this:
mailMessage.getHeaders().set(“Reply-To”, “noreply@…”);
but strangely this does not seem to work either.
Do you have any idea?

Thanks and Best Regards,


We have further investigated this issue with a sample file (attached here) and following code sample and no such issue with headers using the remove method.

MailMessage msg = MailMessage.load("Sample Msg.msg", new MsgLoadOptions());




In order to investigate the issue further, we need your sample file to test at our end and share our findings with you. We have already marked this thread as private so that now only you and Aspose staff has access to the data shared here.Sample Msg.zip (7.1 KB)