Platform SDK: CDO for Windows 2000

DropDirectory CoClass

The DropDirectory Component Object Model (COM) class defines an object used to access a file system containing messages, such as the Simple Mail Transfer Protocol (SMTP) service drop directory.

CLSID
CD000004-8B95-11D1-82DB-00C04FB1625D
ProgID
CDO.DropDirectory
Type Library
Microsoft CDO for Windows 2000 Library
Inproc Server
CDOSYS.DLL
Threading Model
Both

Implemented Interfaces

IDropDirectory

Remarks

Use of the DropDirectory object is not limited to SMTP service drop directory. You can use a DropDirectory object to enumerate the mail messages in any file system folder that the process has rights to access. When gathering messages from within a particular folder, those files with the extension .eml are assumed to be messages, formatted using the RFC 822 and possibly MIME standards.

You cannot change the credentials used to access a folder using the CDO Configuration object. The current thread's security context is always used. If you need to change security contexts to access a particular folder on the network, you must change the thread's security context.

If you use the DropDirectory object in an ASP page, and you plan to access shared folders on the network, or folders with discretionary access control lists that do not give read/write access rights to the IUSR_SERVERNAME security principle (under which the Internet Information Services runs ASP page scripting hosts by default), you must make sure to disallow anonymous access to the ASP page. This forces the client to provide security credentials under which the ASP page will execute.

Example

[Visual Basic]
Dim iDropDir as new CDO.DropDirectory 
Dim iMsgs as CDO.IMessages 
 
Set iMsgs = iDropDir.GetMessages("c:\\inetpub\\mailroot\\drop")
Dim iMsg as CDO.Message
For Each iMsg in iMsgs
  With iMsg
     Debug.Print .From
     Debug.Print .To
     Debug.Print .Subject
     Debug.Print .TextBody
  End With
Next iMsg
[C++,IDL]
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import <cdosys.dll> no_namespace
#include <iostream.h>

main() {
  CoInitialize();
  {
    IDropDirectoryPtr iDropDir(__uuidof(DropDirectory));
    IMessagesPtr iMsgs;
    iMessages = iDropDir->GetMessages("");
    long Count = iMsgs->Count;
    for(long i=1;i<=Count;i++) {
      IMessagePtr iMsg;
      iMsg = iMessages->item[i];
      cout << iMsg->To << endl;
      cout << iMsg->From << endl;
      cout << iMsg->Subject << endl;
      cout << iMsg->TextBody << endl;
    }
  }
  CoUninitialize();

}
[VBScript]
Dim iDropDir 
Set iDropDir = CreateObject("CDO.DropDirectory") 
Dim iMsgs
Dim iMsg
 
Set iMsgs = iDropDir.GetMessages("c:\\inetpub\\mailroot\\drop")
For Each iMsg in iMsgs
  With iMsg
   ' Process the message.
  End With
Next

See Also

IDropDirectory Interface

IMessages Interface