locked
Get Original From Email Address on a forwarded email using EWS Managed API 2.2 RRS feed

  • Question

  • Does EWS Managed API 2.2 support retrieving email address of original sender? For example:

    userA sends email to userB

    userB forwards that email to userC

    I monitor userC Inbox using EWS. Can I retrieve userA email address as the from address of the email I read from userC Inbox (that originated from UserA)?  Can you please provide sample code?  Very much appreciated

    Friday, September 18, 2015 1:05 PM

All replies

  • I would say it's very very difficult if not impossible.

    When userB forward the email, the header will be rebuilt. Although there are references to the original email, there's no way to retrieve the original email because userC does not have access to it.

    The only possible way to get the original sender is to search the message content and look for the keyword from: but there is no way to guarantee its accuracy since it's purely base on word search.

    Friday, September 18, 2015 3:25 PM
  • Have you had any luck with this? I am trying to achieve the exact same thing. 

    I have found the original email address in PR_SENDER_ENTRYID using MCFMAPI but am having trouble parsing it out.

    var senderIdProperty = new ExtendedPropertyDefinition(3097,MapiPropertyType.Binary);
    var response = service.BindToItems(newMails, new PropertySet(BasePropertySet.IdOnly, senderIdProperty));
    var items = response.Select(itemResponse => itemResponse.Item);
    
    foreach (var item in items)
    {
    	object senderId;
    
    	if (item.TryGetProperty(senderIdProperty, out senderId))
    	{
    		// do something
    	}
    }
    If you type this in the immediate window you can see the original email address:
    System.Text.Encoding.Default.GetString((byte[])senderId)

    Any ideas on how to get this in a workable format?


    • Edited by pnewman Tuesday, September 22, 2015 3:49 PM updated to show code
    Tuesday, September 22, 2015 3:38 PM
  • Take a look at Forwarding vs Redirecting in Outlook.  When you set up a Redirect rule the From address is of the original sender.
    Tuesday, September 22, 2015 3:43 PM
  • We are attempting to log e-mails as attachments in our CRM. We were hoping that we could get the users to forward incoming e-mails to a given mailbox and monitor that for new items. 

    I have updated my previous reply with my findings so far.

    • Edited by pnewman Tuesday, September 22, 2015 3:53 PM
    Tuesday, September 22, 2015 3:52 PM
  • Take a look at Forwarding vs Redirecting in Outlook.  When you set up a Redirect rule the From address is of the original sender.

    You didn't mention your forwarding is auto-forwarding using inbox rule in your previous post. Please describe your problem accurately. Otherwise it's a waste of time for yourself and other people.
    Wednesday, September 23, 2015 5:53 AM