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

Free Support Forum - aspose.com

Aspose Email Save errors on attachments (characters)

Hi Aspose,

We are using Apose Email EWS to read mails from Exchange and we are having problems with MSG attachments being changed during the process.

The attached ZIP file contains a MSG file. The attachment "FW: SV: VS: Fejl i eTips Globaletekster. IM251566. Prio 3 [sid:39812]" is having some problems with danish characters.

Test scenarios:

Aspose.Email.dll version 4.3.0.0, Save(MessageFormat.Msg): Danish characters shown as ? in Outlook view.

Aspose.Email.dll version 4.7.0.0, Save(MailMessageSaveTypeOutlookMessageFormatUnicode): Danish characters shown as ? in Outlook view.

Please see attached screen dumps of the mails.

We are reading mails from Exchange using ListMessages and FetchMessage.

With regards

Lars Bøndergaard
Nexcom A/S
lars@nexcom.dk

Hi Lars,


Thank you for your inquiry.

I have investigated this issue at my end using the latest version of Aspose.Email for .NET 4.8.0 and was unable to observe the issue as shared by you. It seems you are not saving the downloaded message in Unicode format. Please refer to the following code sample that saves the message to disc in Unicode format where the text is in similar encoding as in original. Please let us know your feedback if you still face the issue.

Sample Code:

static void Check592794()
{

string dir = “592794\”;


MailMessage msg = MailMessage.Load(dir + “test af plain text med æ¢åƥŠog vedhæftede filer.msg”);


// Create instance of IEWSClient class by giving credentials

IEWSClient client = GetAsposeEWSClient1();


ExchangeMailboxInfo mailbox = client.GetMailboxInfo();


// List all messages from Inbox folder

Console.WriteLine(“Listing all messages from Inbox…”);


//Declare variable for getting specified custom folder uri

ExchangeFolderInfo subfolderInfo = new ExchangeFolderInfo();


//Check if specified custom folder exists

client.FolderExists(mailbox.InboxUri, “592794”, out subfolderInfo);


if (subfolderInfo != null)

{

MailMessage m = MailMessage.Load(“Enron Center Garage.msg”);


client.AppendMessage(subfolderInfo.Uri, msg);


msg.Dispose();


Thread.Sleep(10000);


ExchangeMessageInfoCollection coll = client.ListMessages(subfolderInfo.Uri);


foreach (ExchangeMessageInfo msgInfo in coll)

{

msg = client.FetchMessage(msgInfo.UniqueUri);


msg.Save(“592794\downloaded.msg”, Aspose.Email.Mail.SaveOptions.DefaultMsgUnicode);


Console.WriteLine(msg.Subject);

}

}

}

Hi again,

I changed to Aspose.Email 4.8.0 and changed the Save as you recommended:

_message.Save(filePath, SaveOptions.DefaultMsgUnicode);_message.Save(filePath, SaveOptions.DefaultMsgUnicode);

But I still get the same error with danish letters not shown in Outlook.

See the attached Word document for further details.

With regards

Lars Bøndergaard
Nexcom A/S

Hi Lars,


I have tried the above sample code again and viewed the downloaded message in Outlook 2013, however could not observe any issue as no “?” mark is visible there.

For further investigation, could you please send me credentials of any test account on the said exchange where this message is already present in the INBOX or any other sub-folder? It will help us to re-produce the scenario and provide assistance as soon as possible.

Hi,

I wonder if the problem depends on the Outlook version used to open the MSG file.

The attached file contains the mail after being retrieved from Exchange by Aspose.

Please check if you can see the ?, by opening the mail, click (one click) on the attachment "FW: SV: VS Fejl..." and check the sentence: "Den 16/9 bad vi om skaermdumps p? nedenst?ende."<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

/Lars

Hi Lars,


I have checked your sample 000080488.0001.msg file and observed the ? characters in the attachment body. However, on the other hand if I download message from my test account and open it in Outlook 2013, there is no ? character in the attachment body and text is displayed properly as shown in the attached image.

It seems some system or Exchange specific issue. You may please try this code on some other system in your lab and if problem is not resolved, please send us the credentials of some test account where this message is already uploaded. We will test it again and share our findings as soon as possible.

Hi again,

Lets close this issue, since it seams to be related with error in Outlook and not Apose Mail.

Thanks for your help on this issue.

With regards

Lars Bøndergaard
Nexcom

Hi Lars,

Thank you for sharing your feedback and please feel free to write to us for any additional query related to Aspose.Email.