| Platform SDK: CDO for Windows 2000 |
The following sink example uses Visual Basic to create the log file. To function, the project (Microsoft® ActiveX® DLL) requires a reference set to the following type libraries:
Implements CDO.ISMTPOnArrival
Implements IEventIsCacheable
Private Sub IEventIsCacheable_IsCacheable()
' just returns S_OK
End Sub
Private Sub ISMTPOnArrival_OnArrival(ByVal Msg As CDO.Message, EventStatus As CDO.CdoEventStatus)
Dim fs As New Scripting.FileSystemObject
Dim file As Scripting.TextStream
Set file = fs.OpenTextFile("e:\script\test.log", ForAppending, True )
file.Write "From: " & Msg.From & vbCrLf
file.Write "To: " & Msg.To & vbCrLf
file.Write "Subject: " & Msg.Subject & vbCrLf & vbCrLf
file.Write Msg.TextBody & vbCrLf & vbCrLf
file.Close
EventStatus = cdoRunNextSink
End Sub