Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Transport agent to add a recipient based on subject

$
0
0

I am writing a transport agent for Exchange 2013 that will send email to internal project mailboxes based upon the contents of the subject line of the message.  I have all of the regex working such that if the subject contains, e.g., XYZ 1234, a Bcc is added to the P2 header to Bcc the message to rec1234@domain.com.  We have 6 separate regex tests that all appear to work.  The BCC: rec1234@domain.com shows up in the headers of the message delivered to the original recipient.

What does not work is adding a recipient to the P1 header so that the email will actually get delivered to the bcc.  I realize that I probably need to either resubmit or create a new message with the intended Bcc.

I test using if(item.Recipients.CanAdd), which allows the code to proceed without losing the message entirely.  This wraps a call to item.Recipients.Add(bccaddr), where bccaddr = 'rec1234@domain.com'.

I have googled and searched this forum but have yet to find working samples.  Any ideas?  Ultimately I do not care if it is bcc, cc, or even to.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>