Search code examples
c#-4.0outlook-addin

How to get send to email id not display name before send email c#


How i get email id not display name like "[email protected]".

 var msg = Item as Outlook.MailItem;
 string messageTo = msg.To;

Output: messageTo = "Javal Patel"


Solution

  • Instead of using To/CC/BCC properties, loop through all recipients in the MailItem.Recipients collection and read the Recipient.Address property. You might also want to use the Recipient.Type property (OlMailRecipientType.olTo/OlCC/olBCC) to figure out the recipient type.