简体   繁体   中英

C# ews sender address

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?

您可能正在寻找

String sender = mes.Sender.Address;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM