Add safe senders for multiple users in exchange servers RRS feed

  • Question

  • Hello,

    We have a requirement to add a single email address as safe sender for multiple users in exchange 2013 hybrid setup.

    This can be done by group policy 

    If you need to add the address to the Safe Senders (or Blocked Senders) lists for all users or a group of users, you can use Group Policy to append entries to or replace the list on user’s computers. Create a text file containing a list of the e-mail addresses to append to or overwrite the list then add the path to the Group Policy Editor under Microsoft Outlook, Outlook Options, Preferences, Junk Email. (You'll need the Office group policy templates installed and in use, of course.)

    Use GPO to push out safe and block sender changes

    For multiple users , we can use

    Get-Mailbox | Set-MailboxJunkEmailConfiguration -BlockedSendersAndDomains @{Add="domain1.com", "user@domain2.com"}-TrustedSendersAndDomains @{Add="domain3.com","user@domain4.com"}

    Could you please advise how this can be done for multiple (selected users) in exchange 2013 hybrid mode

    Regards, Ajit

    Tuesday, October 6, 2020 9:11 AM


  • Hi Ajit

    Create a CSV file with header "Emailaddress" and user emailaddress




    User the following with verbose and whatif to see the changes. please test before running the script. one worng execution can wipe the entire user Safe or block list.

    $UsersEmailaddress = Import-Csv c:\windows\temp\UserEmail.csv
    foreach ($User in $UsersEmailaddress)
        Set-MailboxJunkEmailConfiguration $User.Emailaddress -BlockedSendersAndDomains @{Add="domain1.com","user@domain2.com"} -TrustedSendersAndDomains @{Add="domain3.com","user@domain4.com"}


    Tuesday, October 6, 2020 5:00 PM