Article ID: 2545137 - View products that this article applies to.
Expand all | Collapse all

On This Page

INTRODUCTION

When you set up safe senders and blocked senders for mailboxes in Microsoft Exchange Online in Microsoft Office 365, mailboxes store the safe senders and blocked senders for each user independently. This resembles the behavior in earlier versions of Microsoft Outlook.

After the settings are set up, they are persistent in Outlook and in Outlook Web App. Admins who have a hybrid deployment can set up the safe senders and blocked senders to match the settings that are applied by using Group Policy settings in Active Directory. Office 365 admins have to use Windows PowerShell in Exchange Online to set up these settings for user mailboxes.

Note The procedures in this article are intended for Office 365 admins. Individual users who want to make changes to safe senders and blocked senders should go to one of the following Microsoft websites:  

PROCEDURE

Exchange Online admins must be assigned to the following management roles to set up the safe senders and blocked senders settings:
  • Organization Management
  • Records Management
  • Recipient Management
  • Help Desk

How to set up safe senders and blocked senders for a single user

  1. Connect to Exchange Online by using remote PowerShell. For more info about how to do this, go to the following Microsoft website:
    Connect to Exchange Online using remote PowerShell
  2. At the Windows PowerShell prompt, type the following command, and then press Enter:
    Set-MailboxJunkEmailConfiguration -Identity <user@contoso.com> -BlockedSendersAndDomains "<domainA>.com", "<user>@<domainB>.com","..." -TrustSendersAndDomains "<domainC>.com","<user>@<domainD>.com","..."
    Note The <user@contoso.com> placeholder represents the user whose settings are being set up, and the "<domainC>.com","<user>@<domainD>.com","..." placeholder represents a list of domains or individual email addresses that must be added to the list. For example, the following command will block all email messages from "<spamA>.com" and accept all email messages from "john@<spamB>.com" for user@contoso.com:
    Set-MailboxJunkEmailConfiguration -Identity <user@contoso.com> -BlockedSendersAndDomains"<spamA>.com" -TrustedSendersAndDomains john@<spamB>.com

How to set up safe senders and blocked senders in bulk

  1. Connect to Exchange Online by using remote PowerShell. For more info about how to do this, go to the following Microsoft website:
    Connect to Exchange Online using remote PowerShell
  2. At the Windows PowerShell prompt, type the following command, and then press Enter:
    Get-Mailbox | Set-MailboxJunkEmailConfiguration -BlockedSendersAndDomains "<domainA>.com","user@<domainB>.com","..." -TrustedSendersAndDomains "<domainC>.com","user@<domainD>.com","..."
    Note The <user@contoso.com> placeholder represents the user whose settings are being set up, and the "<domainC.com>","<user>@domainD.com","..." placeholder represents a list of domains or individual email addresses that must be added to the list. For example, the following command will block all email messages from "<spamA>.com" and accept all email messages from "john@<spamB>.com" for all the users in Contoso:
    Get-Mailbox | Set-MailboxJunkEmailConfiguration -BlockedSendersAndDomains "<spamA>.com" -TrustedSendersAndDomains "john@<spamB>.com"

How to check safe senders and blocked senders

To check that the safe senders and blocked senders settings were applied successfully, use the Get-MailboxJunkEmailConfiguration cmdlet to confirm the status of the list for any user. To do this, type the following command at the Windows PowerShell prompt, and then press Enter:
Get-MailboxJunkEmailConfiguration -Identity <user@contoso.com>
Note The <user@contoso.com> placeholder represents any user in the organization.

An example of the results is as follows:

Collapse this imageExpand this image
Screen shot of the output of the Get-MailboxJunkEmailConfiguration cmdlet.

How to update an existing safe sender and blocked sender list

After the list is set up, it may have to be updated in the future. When you update the list, you may want remove and to add email addresses or domains. Because these entries are stored as a multivalued variable, any changes that you make could potentially overwrite the previously configured entry items. To prevent this issue, store the existing mailbox configuration in a variable before you try to update the list. To do this, follow these steps:
  1. Connect to Exchange Online by using remote PowerShell. For more info about how to do this, go to the following Microsoft website:
    Connect to Exchange Online using remote PowerShell
  2. Store the configuration in the $Temp variable. To do this, type the following PowerShell command at the prompt, and then press Enter:
    $Temp = Get-MailboxJunkEmailConfiguration <user@contoso.com>
    Note The <user@contoso.com> placeholder represents the user whom you want to change.
  3. Update the list in $Temp. To do this, use the "+=" operator to update BlockedSendersandDomains or the TrustedSendersAndDomains attributes. To do this, follow these steps:
    1. Type the following PowerShell command, and then press Enter to update the Blocked Senders list:
      $Temp.BlockedSendersAndDomains += "<domainC>.com","<user>@<domainD>.com","..."
    2. Type the following PowerShell command, and then press Enter to update the Safe Senders list:
      $Temp.TrustedSendersAndDomains += "<domainC>.com","<user>@<domainD>.com","..."
  4. To commit the updates that were made to the variable $Temp, type the following PowerShell command, and then press Enter:
    Set-MailboxJunkEmailConfiguration -Identity <user@contoso.com> -BlockedSendersAndDomains $Temp.BlockedSendersAndDomains -TrustedSendersAndDomains $Temp.TrustedSendersAndDomains

    Note To apply these changes to all users in an organization, follow the steps in the "How to configure safe senders and blocked senders in bulk" section of this article.

MORE INFORMATION

For more info about the PowerShell cmdlets that are used in these steps, go to the following Microsoft TechNet websites:
Get-MailboxJunkEmailConfiguration
Set-MailboxJunkEmailConfiguration
Still need help? Go to the Office 365 Community website.

Properties

Article ID: 2545137 - Last Review: July 10, 2014 - Revision: 17.0
Applies to
  • Microsoft Exchange Online
Keywords: 
o365 o365022013 o365m kbgraphxlink hybrid o365p kbgraphic KB2545137

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com