Platform SDK: CDO for Windows 2000

Creating an SMTP Message Log File

The following example of an event sink creates a file called Events.txt and then copies the From, To, Subject headers and TextBody of the messages into the file. Each message that arrives is appended to the file. The format of the file is as follows:

From: (from header)
To: (to header)
Subject: (subject of message)

<body of the message>

From: (from header)
To: (to header)
Subject: (subject of message)

<body of the message>
...

The following example is presented in two versions: using C++ and the Microsoft® Active Template Library (ATL) and using Microsoft® Visual Basic®. See Sink Example Using C++ and ATL and Sink Example Using Visual Basic.