Hello to every body i'm using hmail server ver 5.6.6.B2383 and have lot of spams sending using my domain name
in the hmail i have the domin ddd.com and i have 5 accounts let says 1@ddd.com, ...5@ddd.com
but when i checking on the logs i seeing that they are mails sending from unknow@ddd.com
i need an solution because i have tried script for hmailser 4 but it's not working.
working with hmailserver more than 5 years
SCRIPT check if the sender accountid exist before sent the message
-
- New user
- Posts: 1
- Joined: 2020-07-17 20:47
Re: SCRIPT check if the sender accountid exist before sent the message
set "Require SMTP authentication" for "Local to external e-mail addresses" on ALL needed IPrangesafrisoftsolutions wrote: ↑2020-07-17 21:28Hello to every body i'm using hmail server ver 5.6.6.B2383 and have lot of spams sending using my domain name
in the hmail i have the domin ddd.com and i have 5 accounts let says 1@ddd.com, ...5@ddd.com
but when i checking on the logs i seeing that they are mails sending from unknow@ddd.com
i need an solution because i have tried script for hmailser 4 but it's not working.
working with hmailserver more than 5 years
(go into [Settings][Advanced][IP Ranges] and set for all IP ranges ... everyone should authenticate )
since you only write they are using your domain name to send spam i guess you already have "Require SMTP authentication" for "External to external e-mail addresses"
or you can play with scripts
viewtopic.php?p=68117#p68117
___________________________________________________________end of the line
Re: SCRIPT check if the sender accountid exist before sent the message
ALSO need to set 'require auth' for local to local connections
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation
https://www.hmailserver.com/documentation
Re: SCRIPT check if the sender accountid exist before sent the message
Hi,
I have a very old software which cannot use SMTP authentication ...
That's why I activate a certain IP range for sending mail without authentication
.
To narrow it down I only want to allow existing accounts to send mails
Please excuse my English
Thank you
Michael
I have a very old software which cannot use SMTP authentication ...
That's why I activate a certain IP range for sending mail without authentication

To narrow it down I only want to allow existing accounts to send mails
Please excuse my English

Thank you
Michael
Re: SCRIPT check if the sender accountid exist before sent the message
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation
https://www.hmailserver.com/documentation
Re: SCRIPT check if the sender accountid exist before sent the message
Hello,
my colleague and I were able to find a solution for us.
Here is my entire script.
1. Allow only send from your own account, mailadress
2. Check if user exist
3. Rewrite FROM: or add Username to FROM:, For example if the sender is empty
Maybe someone can help
Regards
Michael
my colleague and I were able to find a solution for us.
Here is my entire script.
1. Allow only send from your own account, mailadress
2. Check if user exist
3. Rewrite FROM: or add Username to FROM:, For example if the sender is empty
Maybe someone can help
Regards
Michael
Code: Select all
Option Explicit
Private const g_sAdminPassword = "PASSWORD"
' Sub OnClientConnect(oClient)
' End Sub
' Sub OnSMTPData(oClient, oMessage)
' End Sub
' Sub OnAcceptMessage(oClient, oMessage)
' End Sub
' Sub OnDeliveryStart(oMessage)
' End Sub
' Sub OnDeliverMessage(oMessage)
' End Sub
' Sub OnBackupFailed(sReason)
' End Sub
' Sub OnBackupCompleted()
' End Sub
' Sub OnError(iSeverity, iCode, sSource, sDescription)
' End Sub
' Sub OnDeliveryFailed(oMessage, sRecipient, sErrorMessage)
' End Sub
' Sub OnExternalAccountDownload(oFetchAccount, oMessage, sRemoteUID)
' End Sub
' Allow only send from your own account, mailadress
' Check if user exist
' Rewrite FROM: or add Username to FROM:
Sub OnAcceptMessage(oClient, oMessage)
' Allow only send from your own account, mailadress
dim oApp, i, j, Local, oldFrom, newFrom
Set oApp = CreateObject("hMailServer.Application")
' Give this script permission to access all hMailServer settings.
Call oApp.Authenticate("Administrator", g_sAdminPassword)
If oClient.Username <> "" Then
If LCase(oClient.Username) <> LCase(oMessage.FromAddress) Then
Result.Value = 2
Result.Message = "You are only allowed to send from your own account"
End If
End If
' Check if user exist
Local = 0
For i = 1 to oApp.domains.count
For j = 1 to oApp.Domains.item(i-1).Accounts.count
if (StrComp(oMessage.FromAddress, oApp.Domains.item(i-1).Accounts.item(j-1).Address, 1) = 0) Then
local = local + 1
End If
Next
Next
If local = 0 then
If (oClient.Username = "") Then
Result.Value = 2
Result.Message = "Username not found"
End If
End If
' Rewrite FROM: or add Username to FROM:, For example if the sender is empty
If oClient.Username <> "" Then
If LCase(oClient.Username) = LCase(oMessage.FromAddress) Then
oldFrom = oMessage.FromAddress
newFrom = oClient.Username
oMessage.FromAddress = newFrom
oMessage.From = newFrom
EventLog.Write("Rewrite from " & oldFrom & " - to - " & newFrom )
oMessage.save
Result.value = 0
End If
End If
End Sub
Re: SCRIPT check if the sender accountid exist before sent the message
Help with what?
Is there a problem with your script?
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation
https://www.hmailserver.com/documentation
Re: SCRIPT check if the sender accountid exist before sent the message
No no, everything is ok. No problem. Thank you
I want to help should someone have the same requirement
Thanks and Greetings
I want to help should someone have the same requirement
Thanks and Greetings