Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Exchange / How to Blacklist/Block Sender Domain or an Email Address on Exchange?

June 3, 2019 ExchangePowerShell

How to Blacklist/Block Sender Domain or an Email Address on Exchange?

Exchange Server allows you to block (reject) emails from the unwanted sender domains or certain email addresses. This allows you to configure extra spam protection (in addition to the RBL Exchange filters we considered earlier), if some spam mail outs are pass through your anti-spam system.
An Exchange administrator can block the delivery of emails sent from the certain external domains or addresses to the user mailboxes using ECP graphical interface or PowerShell (EMS).

Contents:
  • Sender Filtering Agent in Exchange
  • Blocking Emails with the Exchange Transport Rules
  • How to Block a Sender in Exchange Mailbox?

Sender Filtering Agent in Exchange

You can enable sender filtering using the Sender Filter agent. Enable the sender filtering agent first:

Set-SenderFilterConfig -Enabled $true

If you need to filter only external senders, run this command:

Set-SenderFilterConfig -ExternalMailEnabled $true

Now you can specify the list of email addresses to be blocked. For example:

Set-SenderFilterConfig -BlockedSenders info@emailing.com,admin@bad-domain.org

You can block all senders from certain domains:

Set-SenderFilterConfig -BlockedDomainsAndSubdomains spammers.com,masssend.net

To get the list of blocked email addresses, run the command:

Get-SenderFilterConfig |fl BlockedSenders,BlockedDomains,BlockedDomainsAndSubdomains

If you want to add new items to the list of blocked domains/addresses, use:

Set-SenderFilterConfig -BlockedSenders @{Add="spam_user@contoso.com"}

Or

Set-SenderFilterConfig -BlockedDomainsAndSubdomains @{Add="block_me.net","spammers.com","fb.com"}

To remove the specific email addresses from the Exchange blacklist, run these commands:

Set-SenderFilterConfig -BlockedSenders @{Remove="spam_user@contoso.com","some@gmail.com"}

This will remove only the addresses you have specified but not the whole list.

Or:

Set-SenderFilterConfig –BlockedDomainsAndSubdomains @{Remove="block_me.net","spammers.com"}

Tip. You can also block a whole IP subnet or a specific IP address:

Add-IPBlockListEntry -IPAddress 232.4.2.0

Blocking Emails with the Exchange Transport Rules

An Exchange administrator can block emails from a certain senders or domains using Exchange transport rules. You can create them in ECP. Open the Exchange Admin Center and select Mail flow.

exchange admin center mail flow

Create a new rule. Add the condition The sender -> is the person or domain is and specify the sender email addresses or domains to be blocked.

configuring blocking sender domain rule in exchange

If you want to block all external emails, select the option that The sender is located… -> Outside the organization. Click More options.

transport rule for sender outside the organization
Then add the action (Add Action) -> Block the message. You can block an email and send an explanation to the sender (Reject the message and include an explanation) or NDR with the error code or delete the email message without sending any notification.

exchange transport rule - Reject the message and include an explanation

Specify the rule priority and save it.

You can also create a transport rule using PowerShell:

New-TransportRule -Name 'Block Spammers' -Comments 'Rule to block spammers' -Priority '0' -Enabled -FromAddressContainsWords 'info@badcontoso.com' -DeleteMessage $true

How to Block a Sender in Exchange Mailbox?

You can block senders for the mailbox of the specific user instead of the whole Exchange organization. The list of trusted and blocked users can be set in OWA (Options -> block or allow). To block an email address, just add these addresses or domains to the Blocked Senders list and save the changes.

owa - blocked senders

The same can be done in Outlook. In the Outlook 2016 go to the Home tab, click the Junk drop-down list and select Junk E-mail Options.

outlook 2016 configure junk emals sender list

On the Blocked Senders tab, add the email addresses or domains you don’t want to receive emails from to the list.

outlook blocked senders

An Exchange administrator can manage the list of blocked domains and email addresses of a certain mailbox using PowerShell:

Get-MailboxJunkEmailConfiguration –Identity jrobinson | FL BlockedSendersandDomains

You can add a new sender address to the Junk list:

Set-MailboxJunkEmailConfiguration -Identity jrobinson –BlockedSendersandDomains @{Add="spam_user@contoso.com"}

Or you can remove the specific email address from the list of blocked senders:

Set-MailboxJunkEmailConfiguration -Identity jrobinson –BlockedSendersandDomains @{Remove="spam_user@contoso.com"}

In the same way, you can manage the sender whitelist in Exchange.

0 comment
0
Facebook Twitter Google + Pinterest
previous post
How to Install and Configure SMTP Server on Windows Server 2016/2012 R2?
next post
Configuring Anti-Spam Protection on Exchange 2013, 2016 – RBL Providers

Related Reading

Using Previous Command History in PowerShell Console

January 31, 2023

How to Install the PowerShell Active Directory Module...

January 31, 2023

Finding Duplicate E-mail (SMTP) Addresses in Exchange

January 27, 2023

How to Disable or Uninstall Internet Explorer (IE)...

January 26, 2023

How to Delete Old User Profiles in Windows?

January 25, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Using Previous Command History in PowerShell Console

    January 31, 2023
  • How to Install the PowerShell Active Directory Module and Manage AD?

    January 31, 2023
  • Finding Duplicate E-mail (SMTP) Addresses in Exchange

    January 27, 2023
  • How to Delete Old User Profiles in Windows?

    January 25, 2023
  • How to Install Free VMware Hypervisor (ESXi)?

    January 24, 2023
  • How to Enable TLS 1.2 on Windows?

    January 18, 2023
  • Allow or Prevent Non-Admin Users from Reboot/Shutdown Windows

    January 17, 2023
  • Fix: Can’t Extend Volume in Windows

    January 12, 2023
  • Wi-Fi (Internet) Disconnects After Sleep or Hibernation on Windows 10/11

    January 11, 2023
  • Adding Trusted Root Certificates on Linux

    January 9, 2023

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Configuring Anti-Spam Protection on Exchange 2013, 2016 – RBL Providers
  • New-MailboxRepairRequest: Fixing Corrupted Mailboxes in Exchange 2016/2013/2010
  • How to Configure DKIM on Exchange Server 2010/2013
  • How to Import and Export Mailbox to PST in Exchange 2016/2013/2010?
  • Get-MessageTrackingLog: Search Message Tracking Logs on Exchange Server
  • Managing Exchange Mailbox Inbox Rules with PowerShell
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top