MailItem.To is empty? RRS feed

  • Question

  • If a customer sends emails me with my mailaddress in the BCC field (the TO field is empty), then if I open the mailitem, TO and BCC is empty and since my users have several inboxes, my AddIn can't tell which inbox the customer sent it to.

    How do I get the emailaddress that my customer emailed me at, when my customer used BCC instead of TO?


    • Edited by M O J O Thursday, July 10, 2014 8:54 AM
    Thursday, July 10, 2014 8:50 AM

All replies

  • Hello Mojo,

    You can check out the Recipients collection, see the corresponding property of the MailItem class. Each Recipient object provides the Type property: olBCC, olCC, olOriginator, or olTo.

    Also you may be interested in the Sender property of the MailItem class. It returns or sets an AddressEntry object that corresponds to the user of the account from which the MailItem is sent.

    Thursday, July 10, 2014 11:46 AM
  • Hi Eugene,

    The "Reciepients" is empty and "Sender" only shows the senders (customers) emailadress not the address the mail was sent to - that is which one of my shared mailboxes the mail was sent to.

    My problem is not when I send an email, but when I recieve an email where the sender used BCC instead of TO.

    Thursday, July 10, 2014 12:01 PM
  • The Outlook object model doesn't provide any property or method for this. The BCC field shouldn't disclose primary recipients:

    With email, recipients of a message are specified using addresses in any of these three fields:

    • To: Primary recipients
    • Cc: Carbon copy to secondary recipients—other interested parties
    • Bcc: Blind carbon copy to tertiary recipients who receive the message. The primary and secondary recipients cannot see the tertiary recipients. Depending on email software, the tertiary recipients may only see their own email address in Bcc, or they may see the email addresses of all recipients.
    It is common practice to use the Bcc: field when addressing a very long list of recipients, or a list of recipients that should not (necessarily) know each other, e.g. in mailing lists.

    Thursday, July 10, 2014 12:18 PM
  • Hi Eugine,

    I'm totally aware of the difference of TO, CC and BCC ... but if you send me an email at using BCC, why shouldn't I be able to see, that you used to email me? That's no secret.

    My problem is, that we have like 20 mailboxes, so my AddIn can't tell which mailbox you sent to.

    Thursday, July 10, 2014 1:29 PM
  • Where your add-in is installed? In Outlook with 20 mailboxes? Where and when do you want to recognize the recipient?

    It is not quite clear to me.

    Thursday, July 10, 2014 1:44 PM
  • There is no way to see that. You might be able to see the "Apparently-To" MIME header, but not all (receiving) servers set that header.

    Check with OutlookSpy if you can see anything useful (click IMessage button), PR_TRANSPORT_MESSAGE_HEADERS is probably the most promising.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, July 10, 2014 2:21 PM
  • My organization has like 20 shared mailboxes.

    Problem is when you (as a customer) sends me an email to either one of the 20 shared mailboxes using BCC (like if you send it to - then when my user opens the mail and tries to export it to our CRM system (using mailitem), then the mailitem TO, BCC, CC and reciepients is all empty, so I have no idea which mailbox you sent it to.

    Thursday, July 10, 2014 4:07 PM
  • Thank you for the clarification.

    I see the following low-level properties that contains the email address you are interested in:





    You can find the email address in the transport headers, see the "Delivered-To: section. DASL - .  

    Thursday, July 10, 2014 5:55 PM
  • Keep in mind that "Delivered-To" is also optional and PR_RECEIVED_BY_xyz / PR_RCVD_REPRESENTING_xyz are not always set.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, July 10, 2014 6:08 PM