0

I'm trying to use Microsoft Graph to get the original email address a message was sent to if it ends up there via BCC.

We're using MSGraph to get emails sent to a shared email inbox in the form of "AppInbox-1234@example.org", where "AppInbox" is the name of the shared inbox and "1234" is an id we use in the app. We have a rule that already moves the email to the shared "AppInbox", which in turn fires off our subscription that looks at the recipients and uses the ID to store contents the message.

This works great if the email address is in the "To" or "CC" fields. But if the email address is the "BCC" field, I can see the email itself, but not the address it was originally sent to (e.g. "AppInbox-1234@example.org"), which I would need for the ID.

When I look at the message itself I only see the empty collection

"bccRecipients": [],

The best lead I've had seems to be around ExtendedProperties, but I haven't been able to figure out how to get the original recipient.

Matt Lane
  • 531
  • 3
  • 5
  • You are looking at receiving message? If that is correct then you are not supposed to see `bccRecipients`. This is whole point of 'BCC'. `bccRecipients` field can only be displayed on sent item within mailbox who sent it, otherwise it is stripped down by transport while message in "transit". – Ivan Franjic Oct 16 '19 at 00:15
  • 1
    @IvanFranjic I'm only interested in the email address that the message has been sent to. So if the email was addressed to "AppInbox-1234@example.org", it will end up in the "AppInbox" inbox, but how would I find the original email address it was sent to ("AppInbox-1234") via graph? – Matt Lane Oct 16 '19 at 19:11
  • This isn't possible since sending bcc message will strip down those properties before mail has been delivered. What is scenario here you are trying to address? Only way to get that info is to pull `bccRecipients` property from sender' `SentItems` folder (assuming message is stored there upon sending). – Ivan Franjic Oct 16 '19 at 22:44
  • If someone sends a message that BCC's "AppInbox-1234@example.org", at some point the mail server knows that the message should be delivered to "AppInbox-1234". Is there anyway to query Graph for that? Or is there a log somewhere with that information? – Matt Lane Oct 17 '19 at 17:59
  • Once message has been handed off by transport to store that information no longer exists because it was stripped down before commit it to user' mailbox. That being said, it knows at some point, but that point is not persisted and it is only during fraction of time until message lands in mailbox. – Ivan Franjic Oct 17 '19 at 21:27

0 Answers0