Best ways to amend .tab files

Discussion for developers using MailEnable.
Post Reply
MartynK
Posts: 1376
Joined: Sat Dec 28, 2002 1:12 am
Location: Hong Kong

Best ways to amend .tab files

Post by MartynK »

I want to modify the contents on the SMTP-DENY.TAB are there any API or .NET routines for this ?

MartynK
Posts: 1376
Joined: Sat Dec 28, 2002 1:12 am
Location: Hong Kong

Re: Best ways to amend .tab files

Post by MartynK »

Anyone from Mailenable want to comment ?

Brett Rowbotham
Posts: 560
Joined: Mon Nov 03, 2003 7:48 am
Location: Cape Town

Re: Best ways to amend .tab files

Post by Brett Rowbotham »

Here is some code from a vb script that dealt with the SMTP-DENY tab which might help you:

FUNCTION OpenMailEnableAccess

Response "Opening Mail Enable SMTP-DENY configuration..."

dim obj
set obj = WScript.CreateObject("MEAOSM.Access")

Response "Done.<br>"

set OpenMailEnableAccess = obj

set obj = nothing

END FUNCTION

SUB SetNewSMTPDENYAddresses

Response "I will now reset Mail Enable's SMTP-DENY list.<br>Removing old list...<br>==================================================<br>"

dim int
dim objAccess
set objAccess = OpenMailEnableAccess
'set filter defaults.
objAccess.AddressMask = ""
objAccess.Host = ""
objAccess.Mode = 1
objAccess.Account = ""
objAccess.Right = ""
objAccess.Status = -1

int = objAccess.FindFirstAccess

IF int=0 THEN
Response "No addresses found in Mail Enable SMTP-DENY configuration.<br>Will move on...<br>"
ELSE

DO WHILE int > 0

Response "Removing IP: "& objAccess.AddressMask

int = objAccess.RemoveAccess

objAccess.AddressMask = ""
objAccess.Host = ""
objAccess.Mode = 1
objAccess.Account = ""
objAccess.Right = ""
objAccess.Status = -1

IF int = 1 THEN
Response "<br>"
int = objAccess.FindFirstAccess
ELSE
Response ". Cannot Remove this Record. Try again later.<br>"
int = objAccess.FindNextAccess
END IF

LOOP

END IF

Response "<br>Creating New SMTP-DENY List...<br>==================================================<br>"

dim objRs
set objRs = objCn.Execute("SELECT AddressMask,Host,Mode,Account,[Right],Status FROM TEMPmeroSMTPDENY;")

IF objRs.eof THEN
Response "No records to add.<br>Will move on...<br>"
ELSE

dim strIP

DO UNTIL objRs.eof
strIP = objRs("AddressMask") &""
Response "Adding IP: "& strIP
objAccess.AddressMask = strIP
objAccess.Host = objRs("Host") &""
objAccess.Mode = objRs("Mode")
objAccess.Account = objRs("Account") &""
objAccess.Right = objRs("Right") &""
objAccess.Status = objRs("Status")
objAccess.AddAccess
objRs.Movenext
Response(" Done.<br>")
LOOP

END IF

Response "<br>Closing Mail Enable SMTP-DENY configuration.<br>==================================================<br>"

set objAccess = nothing

END SUB

Post Reply