Geo Firewall configuration for hMailServer, MailEnable, and SmarterMail email servers

This article applies to the following products:

This article covers the following email servers:

These three Windows email servers share the same network shape. They use the standard mail protocol ports for SMTP, POP3, and IMAP, with all web components (webmail, web administration, ActiveSync/EWS where supported) hosted through Microsoft IIS on ports 80/443. One Geo Firewall 2027 configuration therefore covers all of them. The steps below use the Geo Firewall 2027 rules model (Default Rule and Port Rules). Geo Firewall v4 uses a different model (Port Exceptions), described in Geo Firewall v4 exclusion of traffic from blocking.

If you run on-premises Microsoft Exchange Server, see Geo Firewall configuration for Microsoft Exchange Server. For MDaemon, Kerio Connect, IceWarp, or Axigen, see Geo Firewall configuration for MDaemon, Kerio Connect, IceWarp, and Axigen.

Why geo-restrict these servers

A mail server answers login attempts on every client protocol it exposes (authenticated SMTP, POP3, IMAP, and webmail), which makes it a standing target for automated credential guessing from the whole internet. The built-in defenses in this class of product are counter-based. Both hMailServer's Auto-ban and SmarterMail's IDS rules temporarily block an IP after repeated failures from that address. Distributed, low-and-slow password sprays are shaped to stay under exactly those thresholds by rotating source addresses. Restricting whole territories that have no legitimate users removes that traffic at the packet level before a protocol conversation ever starts. It is a noise-and-exposure reduction layer. Combine it with strong passwords, TLS-only client ports, and timely updates. It does not stop an attacker who relays through an allowed country.

One more consideration applies to hMailServer specifically. The project states on its official repository that it is no longer actively developed or maintained. Servers that no longer receive security updates benefit the most from shrinking who can reach them while they remain in production.

The port surface

Documented defaults: MailEnable's Installing and configuring MailEnable (ME020202), SmarterTools' Commonly used ports for SmarterMail, and the hMailServer SSL/TLS and ports documentation at hmailserver.com/documentation.

Purpose TCP port hMailServer MailEnable SmarterMail
Inbound mail (SMTP) 25 default default default
Client submission 587 added manually default default
SMTP over TLS 465 added manually default default
POP3 / POP3S 110 / 995 110 default. 995 added manually. default default
IMAP / IMAPS 143 / 993 143 default. 993 added manually. default default
Webmail and web services (via IIS) 80 / 443 only if third-party webmail (e.g. Roundcube) is installed under IIS mewebmail + meadmin virtual directories. ActiveSync/CalDAV per edition. web interface (IIS-fronted). ActiveSync, EWS, and MAPI ride the same ports.
CalDAV/CardDAV 8080 / 8443 - Professional and higher via 80/443
XMPP chat 5222 - Professional and higher default
LDAP 389 - Enterprise editions optional
Outbound delivery + DNS 25 out, 53 out all three connect out to remote port 25 for delivery and perform DNS/MX lookups

Administrative access differs by product and is worth noting. hMailServer is administered with a local Windows application (no network admin port). MailEnable has a local MMC console plus the IIS-hosted meadmin web administration (Professional and higher). SmarterMail is administered through its web interface. SmarterMail's first-run setup binds to localhost:9998, which is not reachable from the network by default. It needs no firewall rule unless you deliberately bound it to a public address.

How Geo Firewall 2027 rules apply here

Note the parallel to SmarterMail's built-in Countries to Block security option. That feature gates authentication attempts inside SmarterMail. Connections still reach the service, and message flow is unaffected. Geo Firewall enforces geography at the network-driver level, dropping packets before any listener (SmarterMail, IIS, or anything else on the host, including RDP) sees the connection. The two work well together as separate layers.

Before you begin

  1. Protect your own access first. Add your management IP to Tools -> Settings... -> Policy -> Whitelist -> IPv4 networks. On cloud VMs, accept the first-start Remote Access Lockout Prevention dialog's offer to whitelist the connected Remote Desktop user's address. If RDP is ever lost on an Azure VM, see restoring RDP connectivity after a lockout.
  2. Keep "Automatically whitelist DNS Servers..." enabled (Settings -> Policy -> Whitelist). Mail delivery depends on constant MX lookups.
  3. Update the geographical database (Networks & Geography -> Geo Database -> Pull and Build).

Step 1 — Keep inbound SMTP (port 25) open worldwide

  1. On the Rules tab, open Port Rules, click New, and title the rule "SMTP inbound mail".
  2. Filter: Protocol = TCP, Port Endpoint = Local, port 25.
  3. Actions: Set Incoming Action for All -> Allowed. Click Apply.

Remote mail servers deliver only to port 25 (MailEnable's own installation KB makes the same point and says to keep 25 inbound open or mail stops arriving). If organizational policy rejects mail from specific countries, set exactly those territories to Blocked in this rule. It overrides the Default Rule for port 25 in both directions of policy.

Step 2 — Set the baseline in the Default Rule

On the Rules tab, select Default Rule and set Incoming to Blocked for territories your organization has no traffic with, or use Set Incoming Action for All -> Blocked and set your operating countries plus the [Private Networks IPv4] / [Private Networks IPv6] groups to Allowed for a strict allow-list posture (see allow only specific countries). Decide the [Unknown Networks] entry deliberately. Click Apply on the Default Rule tab. The Port Rule from Step 1 keeps mail delivery on port 25 open worldwide.

Step 3 — Geo-restrict the client protocol ports

Create a Port Rule titled "Mail client ports" with Protocol = TCP, Port Endpoint = Local, and the client ports your server actually exposes from the table above, typically 465, 587, 993, 995, plus 110 and 143 if plaintext POP3/IMAP remain enabled. On the Actions tab, use Set Incoming Action for All -> Blocked, then set the territories where your users live and the [Private Networks IPv4] / [Private Networks IPv6] groups to Allowed.

Geo Firewall 2027 Port Rule actions with per-territory incoming and outgoing selections

If XMPP (5222), LDAP (389), or CalDAV/CardDAV (8080/8443) are in use, add them to this rule or to an additional rule with the same actions.

Step 4 — Geo-restrict webmail on IIS (with a caution for shared hosts)

Create a Port Rule for local TCP 443 and 80 with the same restricted actions to limit webmail (MailEnable's mewebmail/meadmin, SmarterMail's web interface, or Roundcube in front of hMailServer) to your users' territories.

Caution. Ports 80/443 belong to IIS as a whole. On a dedicated mail server that is exactly what you want. On a shared host (a Plesk server hosting customer websites alongside MailEnable or SmarterMail), a geographic restriction on 443 applies to every site on the machine. On such servers, either scope the Default Rule and this rule to territories acceptable for all hosted sites, or leave 80/443 unrestricted (territories Unaffected) and geo-restrict only the mail client ports.

Step 5 — Keep outbound delivery working

If the Default Rule blocks Outgoing traffic to territories you send mail to, delivery there fails because the server connects out to remote MX hosts on port 25. Either keep Outgoing unaffected in the Default Rule for those territories, or add a Port Rule with Port Endpoint = Remote, port 25, and Set Outgoing Action for All -> Allowed. Replies return on the same tracked connection automatically. If mail routes through a smart host or filtering relay instead, add the relay's addresses to the Whitelist and keep outbound geography strict.

Step 6 — Verify and monitor



Last updated: November 20, 2026.