|
re:Dim TextDisclaimer A...
Dim TextDisclaimer As String<br>
Dim HTMLDisclaimer As String<br>
<br>
Implements IEventIsCacheable<br>
Implements CDO.ISMTPOnArrival<br>
<br>
Private Sub IEventIsCacheable_IsCacheable()<br>'Just returns S_OK.<br>
End Sub<br>
<br>
Private Sub Class_Initialize()<br>'TODO: Replace the sample disclaimer text with your own text.<br>TextDisclaimer = vbCrLf & "DISCLAIMER:" & vbCrLf & "Sample Disclaimer Text."<br>HTMLDisclaimer = "<p></p><p>DISCLAIMER:<br>Sample Disclaimer Text"<br>
End Sub<br>
<br>
Private Sub ISMTPOnArrival_OnArrival(ByVal Msg As CDO.IMessage, EventStatus As CDO.CdoEventStatus)<br>If Msg.HTMLBody <> "" Then<br>Dim szPartI As String<br>Dim szPartII As String<br>Dim pos As Integer<br>
<br>'Search for the "</body>" tag and insert the disclaimer before that tag.<br>pos = InStr(1, Msg.HTMLBody, "</body>", vbTextCompare)<br>szPartI = Left(Msg.HTMLBody, pos - 1)<br>szPartII = Right(Msg.HTMLBody, Len(Msg.HTMLBody) - (pos - 1))<br>Msg.HTMLBody = szPartI + HTMLDisclaimer + szPartII<br>End If<br>
<br>If Msg.TextBody <> "" Then<br>Msg.TextBody = Msg.TextBody & vbCrLf & TextDisclaimer & vbCrLf<br>End If<br>
<br>'Commit the content changes to the transport ADO Stream object.<br>Msg.DataSource.Save<br>EventStatus = cdoRunNextSink<br>
End Sub<br>
|
|