环境:1台Exchange有2个SMTP虚拟服务器,一个监听25端口,外连26端口;一个监听26端口,外连25端口
需求:第一个服务器对香港;深圳,没有免责申明,第二个服务器对外,要有免责申明。
操作:1.把下面这段存为***.vbs
Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
TextDisclaimer = vbCrLf %26amp; “DISCLAIMER:” %26amp; vbCrLf %26amp; “Sample Disclaimer added in a VBScript.”
HTMLDisclaimer = “DISCLAIMER:
Sample Disclaimer added in a VBScript.”
If Msg.HTMLBody “” Then
‘Search for the “” tag and insert our discliamer before that tag.
pos = InStr(1, Msg.HTMLBody, “”, vbTextCompare)
szPartI = Left(Msg.HTMLBody, pos - 1)
szPartII = Right(Msg.HTMLBody, Len(Msg.HTMLBody) - (pos - 1))
Msg.HTMLBody = szPartI + HTMLDisclaimer + szPartII
End If
If Msg.TextBody “” Then
Msg.TextBody = Msg.TextBody %26amp; vbCrLf %26amp; TextDisclaimer %26amp; vbCrLf
End If
‘Commit the content changes to the transport ADO Stream object.
Msg.DataSource.Save ‘ Commit the changes into the transport Stream
pEventStatus = cdoRunNextSink
End Sub
2.安装Exchange SDK,在命令行导航到C:\Program files\Exchange SDK\SDK\Support\CDO\Scripts
3.输入命令:cscript smtpreg.vbs /add 1(说明:1为第一个) onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink “mail from=*@your-domain-here.com”
cscript smtpreg.vbs /setprop 1(同上) onarrival SMTPScriptingHost Sink ScriptName “C:\***.vbs”
如要取消:cscript smtpreg.vbs /remove 1(同上) OnArrival SMTPScriptingHost
但是有个问题就是只能应用于MAPI客户端