Restricting E-mailing by Certian Users

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
jckelley
New user
New user
Posts: 8
Joined: 2005-10-19 23:25
Contact:

Restricting E-mailing by Certian Users

Post by jckelley » 2005-10-19 23:38

What i have done is restrict sending outside of the domain for only certian individuals, but allow free reign to the rest of the users. I did this by using this code:

Code: Select all

Sub OnAcceptMessage(oClient, oMessage)

	Dim ReRoute 
	ReRoute = False 

	Dim oRecipients 
	Set oRecipients = oMessage.Recipients 

	For i = 0 To oRecipients.Count - 1 
		If oRecipients(i).IsLocalUser = False Then ReRoute = True 
	Next
	
	If InStr(oMessage.From, "someone@somewhere") And ReRoute = True Then
		ReRoute = True
	Else
		ReRoute = False
	End If

	If ReRoute = True Then 
		Result.Value = 1
	Else
		Result.Value = 0	
	End If 

End Sub
Now the problem with this code it is not very scalable. My thought to improve it is to create a list of names in an array and compare aginst the array. Not sure how to do that in vbScript, but i am sure someone has, and when i figure it out i will post it. However if there is a better way of doing this i would be greatly appreciative.

Jason C. Kelley

Post Reply