环境:1台Exchange有2个SMTP虚拟服务器,一个监听25端口,外连26端口;一个监听26端口,外连25端口
需求:第一个服务器对香港;深圳,没有免责申明,第二个服务器对外,要有免责申明。
操作:1.把下面这段存为***.vbs
<SCRIPT LANGUAGE="VBScript">
Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
TextDisclaimer = vbCrLf & "DISCLAIMER:" & vbCrLf & "Sample Disclaimer added in a VBScript."
HTMLDisclaimer = "<p></p><p>DISCLAIMER:<br>Sample Disclaimer added in a VBScript."
If Msg.HTMLBody <> "" Then
'Search for the "</body>" tag and insert our discliamer before that tag.
pos = InStr(1, Msg.HTMLBody, "</body>", 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 & vbCrLf & TextDisclaimer & 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
</SCRIPT>
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
posted on 2006-09-06 17:17
Leon19821015 阅读(179)
评论(0) 编辑 收藏 引用 所属分类:
Exchange