When I drag and drop a message (.msg) to the desktop and then try to parse it I get the LDAP reference instead of the email address
Email address representation in this format is a well known issue with Microsoft Outlook that can be caused due to a number of reasons, the typical is incorrect configuration of Exchange Server. It is not a limitation at Aspose.Email end but an issue related to email retrieval from Exchange server, and hence, Aspose.Email can not help in this regard.
Thanks for the explanation. I found another issue. If you try to open/read some msg file where there is a Sender with that LDAP name instead of the email address, Aspose.Email return null from message.getFrom() although I can see the sender when I open the msg file in Outlook or any MSG Viewer. It should return at least the sender name. An example file can be provided.
If I open that message with Outlook or with Message Viewer Lite or MSG Viewer tool I can see the recipient name and the LDAP info. Is there at least a way to extract the sender name and not the email address?
I can send you some screenshot if you want, but if I’m able to see the sender name and the Exchance/LDAP name in different viewers, is there a way to extract that with Apose.Email? This is what the users have in their Sent Items box when connected to Exchange server. Without Exchange it works fine, the email address is correctly saved in the MSG message.
I run OutlookSpy and I can see there is SenderName and SenderEmailAddress property in the message, isn’t that enough?
The Sender Name information is available in your sent message sample, and you can retrieve it as follow:
MapiMessage msg = MapiMessage.fromFile("EMAIL_472338\RE_
Blueprint Folders Cleanup.msg");
The sender’s email address is not available at my end in smtp format. If you are drag and dropping a message from the “Sent Items” of Outlook, then it is a known problem. As a workaround, you can extract this information by either using Directory Services or Outlook Object Model. Attached to my reply is a sample application for your reference that uses the Outlook Object Model. Please note, to successfully execute the sample application the Outlook should be necessarily connected to Exchange Server and the message sender should be the user of this Exchange.
Thank you for your help!
The Sender information is normally the same as the From information. However, there is a difference between these two sets of information as you can have a look from this LINK. Also, the MailMessage class doesn’t support Exchange format address and that is why it returns null in case of MailMessage. For MSG file processing, we recommend to use MapiMessage as it loads the complete set of MapiProperties.