I am using below code to read incoming mails from MS Outlook 2010 -
public static void outLookApp_NewMailEx(string EntryIDCollection)
{
NameSpace _nameSpace;
ApplicationClass _app;
_app = new ApplicationClass();
_nameSpace = _app.GetNamespace("MAPI");
object o = _nameSpace.GetItemFromID(EntryIDCollection);
MailItem Item = (MailItem)o;
string HTMLbpdyTest = Item.HTMLBody;
string CreationTime = Convert.ToString(Item.CreationTime);
string strEmailSenderEmailId = Convert.ToString(Item.SenderEmailAddress);
string strEmailSenderName = Item.SenderName;
string Subject = Item.Subject;
}
How can I get sender's mail id. I tried Item.SenderEmailAddress
but its not giving me the sender's email id. It is giving me something like this -
/O=EXG5/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=TEST35345
On the toolbar, select Manage > Export contacts. Choose to export all contacts or only contacts from a specific folder, and then select Export. At the bottom of the page, select Save to save "contacts. csv" in your default Downloads folder.
The address returned now is an (X.400) Exchange address. Please take a look at this MSDN article on how to retrieve the corresponding SMTP address.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With