Restricting Access to your Mail Server
t's possible for spammers to bypass your MX records and send emails directly to your mail server, rendering anti-spam filtering useless. To avoid direct spam you need to make sure only our IPs can communicate to your mail server. This restriction can be implemented either at the mail server, firewall, or router level. This all depends on your infrastructure.
Make sure that all your domains are added to our filtering service and MX have been changed to our filters before making these modifications.
You can find our complete list of IP addresses by viewing the Related Articles.
|IN THIS ARTICLE|
| Office 365/Exchange Online
|| Microsoft Exchange
|Google Apps|| Shared Hosting
Access Restrictions for Office 365/Exchange Online
Configuring a Mail Flow Connector
To configure Exchange Online to reject emails that do not come from our filters you will need to create a mail flow connector.
You can take a look at Microsoft's procedure starting at example 4.
Connect to the
Office 365 admin portal with a global admin account. Go to the
Admin section. Then A
Connectors and then
Partner organization /
Enter a name for the connector, a description and ensure its turned on.
By verifying that the sender domain matches one of the following domains
+ and enter an * (asterisk) to identify all the domains
You can leave the
Reject email messages if they aren't sent over TLS and then add our IP address ranges. (see
Once completed, the configuration should look as follows:
Here is the Powershell command to create the connector with the new Hornetsecurity IP addresses :
New-InboundConnector -Name "Hornetsecurity/Zerospam to O365 inbound" -Comment "Only accept email from Hornetsecurity/Zerospam transport addresses" -Enabled $true -SenderDomains * -RestrictDomainsToIPAddresses $true -RequireTls $true -SenderIPAddresses "188.8.131.52/27", "184.108.40.206/27", "220.127.116.11/29", "18.104.22.168/27", "22.214.171.124/27", "126.96.36.199/24", "188.8.131.52/24", "184.108.40.206/24", "220.127.116.11/24", "18.104.22.168/24", "22.214.171.124/24", "126.96.36.199/24", "188.8.131.52/24", "184.108.40.206/24", "220.127.116.11/24", "18.104.22.168/24", "22.214.171.124/24", "126.96.36.199/24", "188.8.131.52/24", "184.108.40.206/24", "220.127.116.11/24", "18.104.22.168/24", "22.214.171.124/24", "126.96.36.199/24", "188.8.131.52/24", "184.108.40.206/24", "220.127.116.11/24"
Access Restrictions for Microsoft Exchange
Creating a receive connector in Microsoft Exchange
If you chose to enable firewalling in Exchange, you will want to create a receive connector.
Microsoft Exchange 2013
Exchange 2013 uses a web-based interface called Exchange Admin Center (EAC). From the EAC, do the following:
mail flow →
- Select Default Frontend [servername] and click the edit icon.
- On the Default Frontend [servername] select the scoping option and then select the default IP address range (0.0.0.0-255.255.255.255) and click the remove icon.
- Click on the add icon to add all our IPs (see Related Articles) and then save.
Microsoft Exchange 2007 & 2010
- Open the Exchange Management Console.
Server Configuration →
Hub Transport →
Default Receive Connector →
- You will see a section that says Receive mail from remote servers that have these IP addresses.
- Remove the default rule for 0.0.0.0 to 255.255.255.255.
- Add all our IPs (see Related Articles).
- Stop and restart the MSExchangeTransport service.
Microsoft Exchange 2003
In Exchange System Manager, expand the following object:
[ servername ] →
- Right-click the virtual SMTP server where you want to restrict inbound IPs, and then click Properties.
- Click the Access tab, and then Connection.
- Enable the Only the list below option and add all our IPs (see Related Articles).
- Restart Exchange to activate your changes.
Access Restrictions for Google Apps
Instructions for Google hosting
Configuring our filtering with Google hosting requires a few extra steps that must be executed after you change your MX records. Google's instructions can be found here. You can find a shortened and adapted version below.
Google's Inbound Gateway Instructions
- Update your domain’s MX records to point to our filters.
- Sign in to the Google Admin console.
From the dashboard, go to
G Suite →
- In the Organizations section, highlight your domain (top-level org).
- Scroll down to Inbound gateway.
- Hover the cursor to the right of Inbound gateway. To create a new inbound gateway setting, click Configure. To edit an existing setting, click Edit.
Gateway IPs, enter the IP address/range for each gateway:
- Click Add.
- Enter all our IPs (see Related Articles).
- Click Save.
- Check the following box to ensure that spammers do not bypass filtering: Reject all mail not from gateway IPs — If you check this box, G Suite doesn’t accept mail from anywhere other than your inbound gateway.
- Click Save changes at the bottom of the Gmail settings page.
Access Restrictions for a Shared Hosting Provider
If all else fails and your service provider is unable to offer any solutions, we will be unable to prevent any direct spam from being sent directly to you unless the situation changes.