Get To- From and CC. Raw email address

Dear Aspose users and technical support

I wish I could get the email address of the fields of an email.

I do not want the contact name appears next to the email or the contact name. Exclusively email address.

When I use the DisplayTo or SentEmailAddress methods of the mapiMessage object, sometimes happens that it returns something like John McLane [jmclane@nakatomi.com](mailto:jmclane@nakatomi.com)

that I want is something like
For example:
MapiMessage mapi = MapiMessage.FromFile(msgPath);
Console.WriteLine(mapi.GetSentName()) => John McLane
Console.WriteLine(mapi.GetSentEmailAddress()) => [jmclane@nakatomi.com](mailto:jmclane@nakatomi.com)
Console.WriteLine(mapi.GetFrom) => [alejandro@mycompany.com](mailto:alejandro@mycompany.com)
Console.WriteLine(mapi.GetFromName) => Alejandro
Or similar.

Thank you in advance.

Regards

Hi Alejandro,


You can retrieve the sender’s name and email address using the SenderName and SenderEmailAddress properties of a MapiMessage. In order to retrieve the same information for the recipients, please use the Recipients collection of a MapiMessage. Please have a look at the following code and let us know if we can be of any additional help to you in this regard.

MapiMessage mapi = MapiMessage.FromFile(“Sample.msg”);

Console.WriteLine(“Recepients Information:”);

Console.WriteLine("-----------------------");

foreach (MapiRecipient recepient in mapi.Recipients)
{
Console.WriteLine(“Recepient Name: " + recepient.DisplayName);

Console.WriteLine(“Recepient Email: " + recepient.EmailAddress);
}

Console.WriteLine(“Sender Information:”);

Console.WriteLine(”-----------------------”);

Console.WriteLine("Sender Name: " + mapi.SenderName);

Console.WriteLine("Sender Email: " + mapi.SenderEmailAddress);



Again, it works fine.

My .NET App can now display in correct order the name and email adressses of the to and from users.

Thanks!!!

Hi,


Thank you for the feedback.

You can also consult our Product documentation’s Programming Guide to get a detailed insight about Aspose.Emails for .NET features. If you have any additional query/inquiry related to Aspose.Email, please feel free to contact us.