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

Free Support Forum - aspose.com

BUG: message.Subject.Length with 0 length returns an error

Hello All,

I am evaluating the .NET email module and found that the example code doesn’t work very well.

When reading PST files,

If the subject has a illegal character in the subject, the export to MSG fails in the example code. There is a fix inplace for a : in the subject but <>/?* needs to be excluded as a start.

If an email has no subject, it also errors. The message.Subject.Length command returns an error if there is no subject, this should return 0.

Glen

Hi Glen,

Thank you for using Aspose.Email.

  1. Illegal characters need to be removed or replaced by legal characters or a meaningful subject. This is not an issue with the API as the Operating System (OS) doesn’t allow to use these characters as file name.
  2. For an empty subject, please include a NULL check in your code before checking the subject length.
Please let us know if we can be of any additional help to you in this regard.

Hello,

1. I have fixed the illegal chars, you need to fix it in your example code. Its faulty, not the API.

2. I will check for a null prior to length ( already did this anyway ). Is this the expected behavior?

Glen

Hi Glen,

1. We’ll fix the article for removing the special characters first.

2. You need to check for a null to Subject (not to length). The subject can be null if it doesn’t exist in which it raises exception. Therefore, it needs to be checked for NULL before getting its length.

Please let us know if you have any further query in this regard.