Free Support Forum -

Problems with invisible characters in e-mail subject

We’re having problems with e-mails containing invisible characters in the subject or body. Somehow a customer managed to send us an e-mail with a subject containing the substitute character (decimal value 26 in the ASCII table). This caused the ListMessages as well as the SendMail method to crash. We're using version 6.4 of Aspose.Network. With an inbox containing only this troublesome e-mail we got the following exception with the following code.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


ExchangeWebServiceClient client = new ExchangeWebServiceClient("",

"username", "password", "domain ");

ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

Exception: System.InvalidOperationException: {"There is an error in XML document (1, 1236)."}

InnerException: {"'', hexadecimal value 0x1A, is an invalid character. Line 1, position 1236."}

StackTrace: at System.Xml.XmlTextReaderImpl.Throw(Exception e)

at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)

at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String[] args)

at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar)

at System.Xml.XmlTextReaderImpl.ParseNumericCharRefInline(Int32 startPos, Boolean expand, BufferBuilder internalSubsetBuilder, Int32& charCount, EntityType& entityType)

at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)

at System.Xml.XmlTextReaderImpl.ParseText()

at System.Xml.XmlTextReaderImpl.ParseElementContent()

at System.Xml.XmlTextReaderImpl.Read()

at System.Xml.XmlTextReader.Read()

at System.Xml.XmlReader.ReadElementString()

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read172_MessageType(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read175_ArrayOfRealItemsType(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read187_FindItemParentType(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read188_FindItemResponseMessageType(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read233_ArrayOfResponseMessagesType(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read471_FindItemResponseType(Boolean isNullable, Boolean checkType)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderExchangeServiceBinding.Read605_FindItemResponse()

at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer227.Deserialize(XmlSerializationReader reader)

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

Since this affects the ListMessages method one single e-mail can take down our entire customer support. We’re not very happy with that.

We are tempted to forward this e-mail to you to see how well you handle it (assuming you use your own product) J


Thank you for inquiry.

Please send the email that produces the exception. We will check at our end.

You may post here or zip/send to me via email using “Contact” --> “send saqib.razzaq an email” button on this thread.

Hi Peter,

Thanks for the sample message. I have reproduce the issue by keeping this in the Exchange mailbox and calling ExchangeWebServiceClient.ListMessages(). I have logged this bug (ID: 27066). We will look into it and will update you here when a fix becomes available. Sorry for the inconvenience.

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

This message was posted using Notification2Forum from Downloads module by aspose.notifier.