NDR from Exchange server with content conversion error for message with Outlook item from Drafts folder

Aspose.Email version: 4.8.0.

Environment: Exchange 2013 SP1 and MS Outlook 2013.

Scenario: Our Exchange transport agent performs some manipulations with messages (like changing attachments' name etc.).

Issue: If user attached message from Drafts folder in Outlook, then Exchange Server send NDR, to the sender, stating message is corrupted. It works OK, if I attach message from Input or Sent Items folders, but no for Drafts. So Aspose somehow changes message structure and Exchange cannot process it then.

NDR (message is attached):
The email system had a problem processing this message. It won't try to deliver this message again.

Remote Server returned '554 5.6.0 Corrupt message content; STOREDRV.Deliver.Exception:ConversionFailedException.ConversionFailedException; Failed to process message due to a permanent exception with message The message content has become corrupted. ConversionFailedException: Content conversion: Failed due to corrupt TNEF (violation status: 0x00000800) [Stage: CreateReplay]'


I found, that issue is reproducible even if no changes are made. To replicate the issue on your side I attached sample project, which uses EWS to send test message. This test message is a original message received by Exchange from Outlook (contains embedded message, attached from Drafts folder).

Message is SENT successfully (recipient receives message and NO NDR is sent), if PreserveTnefAttachments flag is not specified. But I DO need it to preserve original message format.

Thanks,
Alex Shloma

Hi Alex,


Thank you for your inquiry.

I have investigated this issue at my end using Exchange Server 2010/2013 and your sample project. However, I was unable to reproduce the same at my end. The email is sent out fine and no NDR is sent to the sender. In order to investigate the issue further, is it possible for you to share a test account credentials that we can use at our end to look into it? This will help us assist you further in this regard.

Hi,


I tried the same in another lab with Exchange 2010. The same result - NDR is received.

Can you please describe your steps in order to replicate? How did you create EML file?

The EML file I provided was saved directly from Exchange transport agent.

Unfortunately, I cannot provide access to that server (VPN connection to our internal network is required).

Thanks,
Alex Shloma

Hi,


Here are files and instructions which will help replicate the issue.

I attached sample project to create Exchange routing agent for Exchange 2010 SP1.

Follow these steps to replicate:
  1. Examine project if needed.
  2. Copy appropriate content to “Aspose.Total.lic” (see project).
  3. Recompile.
  4. Copy entire content from “Release” folder to the “c:\TestAgent” folder on Exchange 2010 SP1 server you used for testing.
  5. Open Exchange Power Shell console.
    1. execute command "cd c:\TestAgent"
    2. execute command “.\install.ps1” in order to register agent
  6. Open Outlook.
  7. Create new message; specify subject; attach image and save it (will be saved to Drafts folder).
  8. Create another message.
  9. Click “Attach Item” > "Outlook Item"
  10. Choose previously saved message from Drafts folder.
  11. Add recipient (the same as sender).
  12. Click “Send”.
When message reaches Exchange, log is created in “c:\TestAgent\Logs”. You must not see errors there.

In few seconds sender receives NDR.

To uninstall test agent:
  1. Open Exchnage PowerShell console.
  2. execute command "cd c:\TestAgent"
  3. execute command "cd .\uninstall.ps1"
If you still not able to replicate, please check if TNEF is used on your server. You can see it in the created log file:
Message from: Administrator@qa2010.lab. TNEF part: Not NULL.

Hi Alex,

I have tried the solution by using my test account credentials and slight modification in your code however no NDR is received and mail is sent successfully. Following is the modified code:

try
{
using (var client = Aspose.Email.Exchange.EWSClient.GetEWSClient(
“https:[//outlook.office365.com/ews/exchange.asmx ](https://outlook.office365.com/ews/exchange.asmx)”,
"UserOne@ASE1982.onmicrosoft.com", “Aspose1234”, “”))
{
var opt = Aspose.Email.Mail.MailMessageLoadOptions.DefaultEml;
// I do need to specify PreserveTnefAttachments flag
opt.FileCompatibilityMode = FileCompatibilityMode.PreserveTnefAttachments;
// do some work here
// …
using (var m = MailMessage.Load(“test_message.eml”, opt))
{
m.From = new MailAddress("UserOne@ASE1982.onmicrosoft.com");
m.To.Clear();
m.To.Add(new MailAddress("to_user@domain.com"));
client.Send(m);
Console.WriteLine(“Sent.”);
}
}
}
catch (Exception ex)
{
Console.WriteLine(GetDeepExInfo(ex));
}

Regarding the instructions set for re-producing this issue by registering the agent and then performing the test, I am afraid that currently no such environment is available here. You may please test the above mentioned code with the test account credentials and provide us your feedback?

Hi,

I tried to send to both your and mine Office365 account. No issue.

Perhaps, aspose EWS client makes some changes to the message, and that is why issue is not replicated. I saved message received by Exchange to file and saw, that TNEF (winmail.dat) is different. And I'm sure that Exchange did not converted message yet, because I overwritten OnSubmittedMessage-method, which is called after the message is taken off the submit queue and before content conversion, resolving recipients, or routing data.


Issue is easily replicated in Exchange agent scenario...

You said, that "currently no such environment is available" to test scenario with agent. But in previous post you said, that tried on Exchange Server 2010/2013, so you have environment with Exchange servers. If you just need agent for other Exchange server version or other service pack, let me know and I will provide project.

Thanks,
Alex Shloma

Hi Alex,


I tried it on the remote Exchange server and was not having access to this server. Therefore, I have logged this issue under id: EMAILNET-34645 in our issue tracking system for further investigation by the development team. I will write back here as soon as some feedback is received by the developers.

We are sorry for any inconvenience caused to you in this regard.

Hi, Kashif.


Is there any movement on the issue? Have developers had the chance to look at the scenario?

No pressure, just asking for an update.

Thanks,
Alex Shloma

Hi Alex,


This issue is little complex and requires more time to resolve, thus it is planned in our next release expected in the first week of March, 2015. You may please be patient until this issue is resolved and new release is available for download.

Hi Alex,

Could you please try this issue at your end using the latest version of Aspose.Email for .NET 5.2.0 and let us know your feedback? We need your feedback to investigate the issue further if it still exists with this latest release of Aspose.Email for .NET.

Hi, Kashif Iqbal


That what I started to do yesterday. Was not able to replicate. Will continue today and let you know the results.

Thanks,
Alex Shloma

Hi Alex,

Thank you for share your feedback. Please share your findings with us once you are done with your testing. We’ll share the feedback with our product team for assisting your further.

Tried with both DLLs (old and the latest one).


The same tests, which fails on the old DLL, works fine on the new one. So think issue is resolved.

Thanks,
Alex Shloma

Hi Alex,

Thank you for sharing your feedback. Please feel free to write to us in case you have any other query/inquiry related to Aspose.Email API.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.