Question

I am trying to get specific information about an email (messageID, mailboxname, date, from, to, subject, body, seq, date_inserted_db, hasattachment) and I can successfully get them using either the item.whatever method or using emailMessage to cast the item like shown in How to get the sender of an e-mail in EWS MAPI?. How can i get the actually email address of the sender?

EmailMessage mes = (EmailMessage)item;
String sender = mes.Sender.Name;

This gives me something like "toosweetnitemare" instead of toosweetnitemare@whatever.com. I have also tried

System.Web.Mail.MailMessage receivedMessage = GetMail();
string replyTo = receivedMessage.From;

But that wouldnt play nice with my code and kept telling me to change my framework version. Strange and I dont want to use it.

I want the address using either EWS or casting. Any ideas?

Was it helpful?

Solution

You're probably looking for

String sender = mes.Sender.Address;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top