How to Configure SMTP relay on hMailServer – IIS MMC error

This post is to demonstrate the process to configure hMailServer as an email relay with Microsoft Office 365. You then can point your SMTP of applications, printers, device alerting etc to this server for reporting, Scan-to-Email, and email alerting.

Issue

We used to configure SMTP within IIS as an SMTP replay server to work with office 365, since Windows Server 2022, we have noticed an error about MMC when you open up the property tab of your SMTP server “MMC has detected an error in a snap-in. It is recommended that you shut down and restart MMC”, the error is intermittent and not manageable.

There is no official fix for it yet as Microsoft is deprecating the SMTP stack, SMTP service is still working but you just cannot manage it via IIS properly. You can modify the XML configuration file to get it working but we see no value in doing that.

https://techcommunity.microsoft.com/t5/windows-server-insiders/server-buld-20303-1-iis-6-manager-crashes-trying-to-edit-smtp/m-p/2215174

Configure hMailServer as Email relay with Microsoft – Alternative Solution

Let’s move on. Firstly you need to uninstall the SMTP role via Service Manager – Features – SMTP Server

Download and install the hMailServer on Server 2022 as a windows service, you also will be asked to set up an administrator password just for the hMailServer application.

Open up the hMailServer Administrator prompt, you can see it is almost a full Email server package but we are only going to use it as an SMTP relay to send emails, no need to receive, to setup domain etc.

de-check “POP3” and “IMAP” as we are not using it

SMTP Relay Configurations-General setting

Delivery of E-mail settings, here we use Microsoft O/M365 as the “SMTP relayer”, you can find your Exchange Online Protection domain via your SFP records or 365 Domain setup section

Other settings for SMTP relay, configure it as per business requirement.

Add New Trusted IP in hMailServer

To add a new trusted IP, go to “Settings” – “Advanced” – “IP Ranges” –“Add”

Put your printer or application server IP (devices need SMTP relay to send alerts) in the IP range, configure the rest of the options as below, save the config

Configuration on Microsoft Office 365 / M365 portal – Exchange Online

On the Microsoft Exchange Online side, we need to add a connector to “whitelist” our public IP so it is “trusted”

Navigate to Exchange Admin Center, go to “Mail flow” – “Connectors”

Add a new connector with the below properties:

Mail flow Scenario: From Your Organization's email server to Office 365
Name: Sensible name
Status: On
How to identify email sent from your email server: your public IP

Configure your application to point to hMailServer

Now you go back to your Application server or Printer. put the SMTP config below and a sample example is posted here


•	SMTP authentication:  NO
•	SMTP Server: hMailServer.ictfella.com  (internal private IP will work but we prefer DNS name in case of server migration,IP change etc)
•	SMTP Port: 25
•	SMTP username/password: N/A
•	Sender address:  [email protected]  (please be aware domain HAS to be the autorized domain in Office365 tenant)

Useful links

https://www.hmailserver.com/

1 thought on “How to Configure SMTP relay on hMailServer – IIS MMC error”

Leave a Comment

Your email address will not be published. Required fields are marked *