Answer the question
In order to leave comments, you need to log in
How to filter outgoing mail in MTA on hmailserver?
New to mail servers. Interested in this question.
I have my own mail server at hmailserver. It is necessary on some mailboxes to prohibit sending letters to the outside world. But on hmailserver, as I understand it, filters are applied only to incoming mail, do I understand correctly? And how can this be done differently?
Thank you.
Answer the question
In order to leave comments, you need to log in
Script processing
Sub OnDeliverMessage(oMessage)
Dim LocalOnlyAccounts(100)
Dim temprecipients(100)
Dim i, j, k, l
Dim varDomain
Dim varAddress
varDomain = "mydomain.com"
LocalOnlyAccounts(0)= "user1" & "@" & varDomain
LocalOnlyAccounts( 1)= "user2" & "@" & varDomain
For i = 0 to uBound(LocalOnlyAccounts)
If oMessage.FromAddress = LocalOnlyAccounts(i) then 'sender is restricted account
for j = 0 to oMessage.recipients.count -1
temprecipients( j) = oMessage.recipients.item(j).address
next 'j
j = 0
k = oMessage.recipients.count -1
while j <= k
If oMessage.recipients.item(j).islocaluser = false then 'remove non-local recipients
l= j
while l < k
temprecipients(l) = temprecipients(l+1)
l=l+1
wend
temprecipients(k) = " "
k=k-1
else
j=j+1
end if
wend
oMessage.clearrecipients()
For j = 0 to k
varAddress = temprecipients(j)
oMessage.AddRecipient "", varAddress
Next 'j
oMessage.save
End if
Next 'i
End Sub
Until the question was posted here, the answer was not found.
As a result: https://www.hmailserver.com/forum/viewtopic.php?f=...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question