I have a transport rule that will block internal employees from emailing certain external email address' and send a notification that the message was blocked from going out. That's working fine but I will need to add the external email address' from an ever growing list that will be automatically generated on a day to day basis. I am looking for a way to automate the addition of the email address' to the transport rule. I tried using the following but it applied the change to all outgoing email, internal and external so all email sent was being blocked.
$address = import-csv C:\address.txt
Set-TransportRule "CASL Test" -SentTo $address
The address.txt file mentioned above only had 2 email address' in it but the production list will have hundreds or even thousands of address to prevent mail flow to.
This is in preparation of a new Canadian law coming up on July 1st regarding spam and opting in and out of receiving commercial email for products and/or services (basically anything sales related).
Any assistance in this is highly appreciated.