DBMAIL的邮件日志,是非常规范的,想要统计外发的数量,写个VB脚本,就可以自动统计到了,下面这个脚本,是用于统计发信日志中的外发数量.前提条件,就是你开启了DBMAIL日志的发信日志.然后日志都会放到DBMAIL\OTHER目录下,发信日志,都是send+日期格式开头的.
将下面的内容,保存到DBMAIL\OTHER目录下,命名为: 输入查找内容统计.wsf
输入用户名字,可以统计每个用户的外发数量,输入@可以统计整个域名的外发数量
<job id="HowManyLines">
<script language="VBScript">
Const ForReading = 1
Dim objFSO, fold, f, strMsg, fileNames(100), objFile, lineCount(100),files,i,Tempstrtxt,Searchkey
set objFSO = CreateObject("Scripting.FileSystemObject")
set WshShell = WScript.CreateObject("WScript.Shell")
strMsg = InputBox("请输入域名或者账号等关键字:")
Searchkey = Trim(strMsg)
'请注意修改下面DBMAIL的日志路径
set fold = objFSO.GetFolder("D:\DBMail\other\")
set files = fold.Files
For Each f in files
If objFSO.GetExtensionName(f) = "txt" and instr(f,"send")>0 Then
Set objFile = objFSO.OpenTextFile(f,1,TriStateTrue)
Do While objFile.AtEndOfStream <> True
Tempstrtxt = Trim(objFile.ReadLine)
'请把030904.com修改成你自己的域名,然后把那个10换成你域名的实际长度,比如你域名是web.com,那么换成instr(right(Tempstrtxt,7),"web.com")=0
If InStr(Tempstrtxt,Searchkey)>0 and InStr(Tempstrtxt,"<START>")>0 and instr(right(Tempstrtxt,10),"030904.com")=0 Then
lineCount(i) = lineCount(i) + 1
End If
Loop
objFile.Close
fileNames(i) = f.Name
i = i + 1
End If
Next
strMsg = ""
For i = 0 To UBound(fileNames)
If fileNames(i)<>"" Then
strMsg = strMsg & fileNames(i) & ":" & "外发数量:" & lineCount(i)
strMsg = strMsg & Chr(13)
End If
Next
MsgBox(strMsg)
</script>
</job>