How to add same emailt o safe sender list to multiple user

Cynthia Pascacio - OnMicrosoft 21 Reputation points
2021-02-05T23:48:57.067+00:00

Hello,

I want to add a specific email address to the safe sender list for a list of users that are in a CSV file.
I was able to do this to my email address using the format below, but need to add it to a lot of users:

Set-MailboxJunkEmailConfiguration "Test User" -TrustedSendersAndDomains @{Add='TestEmail@Stuff .com'}

Any ideas?

Exchange Exchange Server Management
0 comments No comments
{count} votes

Accepted answer
  1. Ivan_Wang-MSFT 76 Reputation points
    2021-02-08T02:28:19.177+00:00

    Hi @Cynthia Pascacio - OnMicrosoft ,

    As said above, you could run the above commands to add the specific email address to the safe sender list for multiple users in the .csv file. And you could also run the following commands to view the safe sender list of the specific users(You could modify the property name($_.Name) of the parameter "-Identity" if you specify another one in the .csv file):

    Import-Csv "The path to the CSV file" | foreach-object {Get-MailboxJunkEmailConfiguration -Identity $_.Name | Select-Object Identity, TrustedSendersAndDomains}  
    

    65115-1.png

    Besides, the following snapshots are my test result with the commands which michev and AshokM-8240 provided above, please check if they are helpful to you:
    65121-2.png

    65116-3.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2021-02-06T07:30:24.33+00:00

    Assuming you have a CSV file named blabla.csv with a column "UPN" to designate the user:

    Import-CSV blabla.csv | % { Set-MailboxJunkEmailConfiguration $_.UPN -TrustedSendersAndDomains @{Add='******@gmail.com'}  }
    
    0 comments No comments

  2. Ashok M 6,846 Reputation points
    2021-02-06T07:56:46.25+00:00

    Hi,

    You can use the below command,

    First run the command, Import-Csv "filename" and check if it lists all the names with the header "Name". then run the below command to set the junk email.

    Import-Csv "filename" | foreach-object {Set-MailboxJunkEmailConfiguration -Identity $_.Name -TrustedSendersAndDomains @{Add='TestEmail@Stuff .com'}}

    Incase if you face any issues, you can use the email address in the CSV with header "Email" and change the Identity to $_.Email in the above command. You can also use -WhatIf switch to check the command before setting.

    Import-Csv "filename" | foreach-object {Set-MailboxJunkEmailConfiguration -Identity $_.Name -TrustedSendersAndDomains @{Add='TestEmail@Stuff .com’} -Whatif}

    If the above suggestion helps, please click on "Accept Answer" and upvote it.


  3. Cynthia Pascacio - OnMicrosoft 21 Reputation points
    2021-02-08T18:35:02.947+00:00

    Hello All, thank you for your suggestions. I tried them and I can see the 3 test email addresses being added to my account, the weird part is that I wasn't able to see them at first no matter how many times I ran the cmdlets. I then ran the cmd again below:

    Set-MailboxJunkEmailConfiguration "Test User" -TrustedSendersAndDomains @{Add='TestEmail@Stuff .com'}

    and after I did that i was able to see all 3 test emails on the list. Is there a timing or do the addresses get added but are hidden?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.