I inherited a PS script that reads emails via EWS. I am trying to pickup the CC and BCC recipients.
I have this code.
$carboncopy = "" $blindcarboncopy = "" foreach (Recipient in $MailItem.Recipients) { if (Recipient.Type -eq 1) { if (CCEmailAddress.length > 0) CCEmailAddress += ";"; $carboncopy += recip.Address; } if (recip.Type -eq 2) { if (CCEmailAddress.length > 0) CCEmailAddress += ";"; $blindcarboncopy += recip.Address; } }
But it doesn't seem to work. I feel like I'm very close but probably not looking at the proper objects?
Thanks for any help, Alan