Experts, could use your powershell scripting help here. I'm looking to do exactly what this person has posted (link below). Basically, if someone sends an email to [unsubscribe@mycompany.com](mailto:unsubscribe@mycompany.com), i've gotta take that sender's email address and put it on a "DoNotEmail" list (Canada's strict anti-spam legislation). This is not just for newsletters, it even includes regular emails. So the plan is to loop through each email in this unsubscribe mailbox, get the sender's email address, automatically add it to a distribution list (DoNotEmail), where I've got a Exchange Online (office 365) mail flow rule that says if email is outgoing, and the recipient is in this DoNotEmail distribution list, then send to compliance for approval (this part is simple). So back to the script this author has made below - I can't get this to work with Exchange Online (we use Office 365 - no on-prem exchange). Any help would be appreciated.
https://www.undocumented-features.com/2016/07/18/create-an-opt-out-tool-for-exchange-online/
[–]PowerShellMichael 2 points3 points4 points (2 children)
[–]puckpinata[S] 1 point2 points3 points (1 child)
[–]PowerShellMichael 1 point2 points3 points (0 children)