On four installations that we have, we need to create a new table in the Builtin Database. We can do this on other installs with MS SQL, but can't figure this one out. My guess is we have to create the app first, then use the database.script(???) piece.
Martin does that with this script viewtopic.php?f=20&t=13890
There are some SQL commands to run to create the new table, and then the VBS adds data to that table as mail is received.
More Information. The script I use simply records a bounce email into a text file. Here is the script:
Sub OnDeliveryFailed(oMessage, sRecipient, sErrorMessage)
Const ForWriting = 2
Const ForAppending = 8
Dim strDrive, strPath
strPath = "\Program Files\hMailServer\Logs\bounce-log.txt"
Set objShell = CreateObject("WScript.Shell")
Set objEnv = objShell.Environment("PROCESS")
strDrive = objEnv("systemdrive")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strDrive & strPath, ForAppending,true) ' open for Appending, if not there CREATE IT
The problem is that periodically, I get an hMail error:
"ERROR" 2348 "2011-12-13 20:20:01.343" "Script Error: Source: Microsoft VBScript runtime error - Error: 800A000D - Description: Type mismatch: 'OnDeliveryFailed' - Line: 39 Column: 0 - Code: (null)"
But I cannot see the error in my script. So I figured, I'll put it into a table in the db, which leas to my question.
I suspect that one of the three values passed to the sub are in fact NULL to cause this error, but I'm not sure how that could happen. Perhaps an unauthenticated mail ,FROM is blank, TO a third party that doesn't accept the message and hMailserver tries to send a NDR to NULL - But I'm really not sure that this could happen either...
OnDeliveryFailed is one of the few subs that I don't use