System.Web.Mail FAQ

Complete FAQ Listing

4.2.4 "Could not access 'CDO.Message' Object - Part 2 Printer Friendly   Email This FAQ   Discuss

The following suggestion comes from Duncan Smart. Although I haven't tested this, it looks interesting and may help someone out. One note, use at your own risk, as you will be modifing the IIS metabase.


The following exerpt is from Duncan:

Having had a look at I thought you and your readers would find the following useful.

Below is a script we use when deploying our application. When you don't set the SmtpServer property (or set it to null) then CDO tries to use a local IIS SMTP service if installed, and sends emails by simply creating a text file to c:\inetpub\mailroot\pickup\. The "Could not access CDO.Message object" error message is due to CDO not being able to read the IIS metabase to locate the PickupDirectory value - which is where it will write emails to. This script allows ASPNET to look up the PickupDirectory value from the IIS metabase. In addition you might need to grant ASPNET access to the pickup directory itself Inetpub\Mailroot\Pickup.

For more control over MetaBase ACLs then use the MetaAcl.vbs utility:

Hope you, or someone finds it useful!

Duncan Smart

[ vbscript ]
Dim obj, acl, ace, aspNetAce
Set obj = GetObject("IIS://localhost/SMTPSVC")
Set acl = obj.AdminAcl

Dim aspNetAcePresent : aspNetAcePresent = false

' Find "machine\ASPNET" access control entry
For Each ace in acl.DiscretionaryACL
If endsWith(ace.Trustee, "\ASPNET") Then
aspNetAcePresent = True
Exit For
End If

If Not aspNetAcePresent Then
Set ace = CreateObject("AccessControlEntry")
ace.Trustee = "ASPNET"
ace.AccessMask = &H1 ' Read access
acl.DiscretionaryACL.AddAce ace

' Save changes
obj.AdminAcl = acl

WScript.Echo "ASPNET account granted Read access to

WScript.Echo "ASPNET account already has access to
End If

Function endsWith(str1, suffix)
EndsWith = (Mid(str1,Len(str1)-Len(suffix)+1) = suffix)
End Function


Discuss This FAQ Item
Got a question? Another Suggestion? Want to post your solution? Discuss it below.
New Post
  • java mail    [ Reply ]
  • can't acess cdo.message    [ Reply ]
    • RE: can't acess cdo.message    [ Reply ]
    • RE: can't acess cdo.message    [ Reply ]
  • post test    [ Reply ]