Convert SenderEmailAddress from LDAP to SMTP?

Using Aspose.Network is it possible to convert an SenderEmailAddress from LDAP to SMTP?

For example,

LDAP:

/O=ORGANIZATION_NAME /OU=EXCHANGE_GROUP /CN=RECIPIENTS /CN=USER_NAME

SMTP:

username@address.com

Hi,

Thank you for inquiry.

Aspose.Network always tries to get the smtp address when message is loaded from Exchange Server. Could you please tell your scenario?

Do you download the message using ExchangeWebServiceClient.FetchMessage() or other class?
Or do you already have a saved MSG file and are loading it in MailMessage or MapiMessage? Please provide the sample file in this case.

The message is extracted from a saved PST which will most likely be processed on a machine that is not connected to the Exchange Server. I have tried to access the Sender email address using both MailMessage and MapiMessage

MailMessage mailMsg = MailMessage.Load(filePath, Aspose.Network.Mail.MessageFormat.Msg);
string senderAddress = mailMsg.From.Address;
            
MapiMessage msg = MapiMessage.FromFile(filePath);
string senderAddress = msg.SenderEmailAddress;
 
Is it possible to get the SMTP address?
 
Thanks for your help!

Hi,

Thanks for the information.

Could you please post a sample MSG file here, we will check if it contains smtp mail address and it can be fetched or not. You may either post here or zip/send me via email using “Contact” --> “send saqib.razzaq an email” button on this post.

Hi,

I have received the sample file and tried to extract the sender’s address in smtp format, but I was um-successful. When opened in MS Outlook, the To field shows the smtp address, but from field shows in other format.

I have forwarded it to the development team for their analysis. I will update you here as I get any news.

try the substorages

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


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

Thank you for investigating this issue. However, it does not appear to be fixed in Aspose.Mail 1.1. I have checked the substorages and do not find the SMTP address for internal exchange emails. Am I missing a step and if so can you please provide me details for how I can extract the SMTP addresss?


Thanks again,
Jeff

Hi Jeff,


Please try the below source code snippet for your need and let us know of your results.

[C#]
MapiMessage mapimessage = MapiMessage.FromFile(@“C:\temp\messages\message.msg”);

MailAddress mapisender = new MailAddress(mapimessage.Headers[“From”]);

Best Regards,

Babar,


That works perfectly! As always, thank you for the excellent support!!!

Jeff

Hi Jeff,


Thank you for the sample message file that you have sent through a private message. We will investigate the issue on our end and will keep you posted with updates.

Regards,

Hi again,


Can you please provide us some details regarding the origin of your shared email message. We would like to know, how this message was saved to disk? If with Outlook then it’s version?

Thank you

Babar,


I am using Outlook 2007 (12.0.6562.5003) SP2 MSO (12.0.656205003) on Windows 7 64-bit. I created the email by sending it to myself. Then I saved it to disk by dragging and dropping the message from with in my Sent folder in Outlook to my desktop. I hope this information is helpful, please let me know if you need anything else.

Thanks,
Jeff

Hi Jeff,


Thank you for the information.

I have re-opened the ticket associated with this thread to investigate the cause of problem. As soon as we receive any updates, we will post that here for you.

We are sorry for your inconvenience.

Was this ever resolved?

Hi Jeff,


Please accept our appology for a delayed response.

After further analyzing your provided message, we have found that this message does not contain Internet Headers. This is usual for messages in Sent Items and you can verify it by opening the message in Outlook and view message options. In such case, the MapiMessage created will not contain any headers and MapiMessage.Headers[“From”] will return NULL.

In addition, Aspose.Email API checks for the PR_SENDER_ADDRESS property of the message and displays the SMTP address only if the MSG contains the SMTP format address. You can use Outlook Spy for this purpose and check it in code as follow:

string sAddress = mapiMsg.TryGetPropertyString(MapiPropertyTag.PR_SENDER_EMAIL_ADDRESS);