Add sender to Safe Senders List through PowerShell

Modified on Mon, 01 Apr 2024 at 10:42 PM





Add sender to Safe Senders List through PowerShell


Blocking pictures can help protect your computer. Microsoft Outlook is configured by default to block automatic picture downloads from the Internet. However, you can unblock pictures to be downloaded and automatically image download using Safe Senders List.


Configuring a Safe Senders list for all users using both Outlook Web Access (OWA) and the desktop client, can be achieved through a combination of methods. Since Group Policy Objects (GPOs) only apply to the Outlook desktop client and don't affect OWA settings, additional step through PowerShell Script is needed to ensure that Safe Senders lists are populated for all users. 


Utilize PowerShell scripts to manage Safe Senders lists for OWA users. You can use the Exchange Online PowerShell module to connect to your Exchange Online environment and manipulate Safe Senders lists programmatically. 



Here's a basic example of how you can add a sender to the Safe Senders list for a single user using PowerShell:

# Add sender to Safe Senders list for a single user
Set-MailboxJunkEmailConfiguration -Identity <UserEmailAddress> -TrustedSendersAndDomains @{Add="<SenderEmailAddress>"}


After testing the above, you can add a sender to the Safe Senders list for all mailboxes using PowerShell:

# Add sender to Safe Senders list for all mailboxes
Get-Mailbox -ResultSize Unlimited | Set-MailboxJunkEmailConfiguration -TrustedSendersAndDomains @{Add="example.com","example@domain.com"}



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article