Ip ranges added by script do not work (bug?)

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
trackballpower
New user
New user
Posts: 2
Joined: 2022-08-18 17:05

Ip ranges added by script do not work (bug?)

Post by trackballpower » 2022-08-18 17:16

I removed the existing ip ranges and added an ip range for localhost (172.0.0.1) by using this powershell script:

$obApp = New-Object -ComObject hMailServer.Application
$hMailLogin = $obApp.Authenticate("Administrator","") #| Out-Null
if ($hMailLogin)
{
$SecurityBan = $obApp.settings
$SecurityRge = $obApp.settings.SecurityRanges.Add()
$SecurityRge.AllowSMTPConnections = $true
$SecurityRge.AllowIMAPConnections = $false
$SecurityRge.AllowPOP3Connections = $false
$SecurityRge.EnableSpamProtection = $false
$SecurityRge.EnableAntiVirus = $false
$SecurityRge.RequireSSLTLSForAuth = $false
$SecurityRge.allowdeliveryfromlocaltolocal = $true
$SecurityRge.allowdeliveryfromlocaltoremote = $true
$SecurityRge.allowdeliveryfromremotetolocal = $true
$SecurityRge.allowdeliveryfromremotetoremote = $true
$SecurityRge.RequireSMTPAuthLocalToLocal = $false
$SecurityRge.RequireSMTPAuthLocalToExternal = $false
$SecurityRge.RequireSMTPAuthExternalToLocal = $false
$SecurityRge.RequireSMTPAuthExternalToExternal = $false
$SecurityRge.Expires = $false
$SecurityRge.priority = 15
$SecurityRge.LowerIP = "172.0.0.1"
$SecurityRge.UpperIP = "172.0.0.1"
$SecurityRge.name = "Localhost"
$SecurityRge.save()
}

After running the script and refreshing the ip ranges in the hMailServer administrator interface, i can see the new ip range "Localhost" is present and configured correctly.
When i after that try to sent an email using a powershell command, i get this error:

Send-MailMessage : Unable to read data from the transport connection: net_io_connectionclosed.

If i remove the newly created "Localhost" ip range, so that no ip ranges are present, then i get the same error message when i try to sent an email.
It is almost like my scripted ip range is completely ignored.

If i create an ip range manually, then that newly created ip range does function properly.
Could this be a bug?
I am using the latest stable hMailServer version 5.6.8.2574.
Tried it both on Windows server 2016 as well as Windows server 2022.

User avatar
RvdH
Senior user
Senior user
Posts: 2317
Joined: 2008-06-27 14:42
Location: The Netherlands

Re: Ip ranges added by script do not work (bug?)

Post by RvdH » 2022-08-18 17:34

172.0.0.1 :lol:

You might wanna try 127.0.0.1 :wink:

Or start the Administrator GUI, Go to 'IP Ranges' and press "Default" button (Warning: all other defined IP ranges are gone then)
CIDR to RegEx: d-fault.nl/cidrtoregex
DNS Lookup: d-fault.nl/dnstools
DKIM Generator: d-fault.nl/dkimgenerator
DNSBL Lookup: d-fault.nl/dnsbllookup
GEOIP Lookup: d-fault.nl/geoiplookup

trackballpower
New user
New user
Posts: 2
Joined: 2022-08-18 17:05

Re: Ip ranges added by script do not work (bug?)

Post by trackballpower » 2022-08-18 17:42

Completely looked over that! Thanks for the headsetup.

Post Reply