Run-time error 800a0046 with CDONTS.Newmail object

Symptoms

When you try to send mail by using the CDONTS.NewMail object in Active Server Pages (ASP), you may receive the following error message, where xxx is the line number that uses the Send method of the NewMail object:
Microsoft VBScript runtime error '800a0046'
Permission denied
/filename.asp, line xxx

Cause

This error occurs because the ASP page runs in its own memory space through Internet Information Services (IIS). To see if this is the case, follow these steps in IIS 4.0:
  1. Open the Microsoft Management Console (MMC) for IIS 4.0.
  2. Right-click the root folder or virtual folder in which your page resides.
  3. Click Properties.
  4. Click the Home Directory or the Virtual Directory tab.
  5. Verify that Run in separate memory space is selected.

In IIS 5.0, you can see that High (isolated) is selected in the
Application Protection list.

Resolution

To resolve this issue, Microsoft recommends that you run the page in-process. To run the page in-process, click to clear the Run in separate memory space check box in IIS 4.0. Follow the steps in the "Steps to Reproduce the Behavior" section of this article, but in Step 5, click to clear the check box in IIS 4.0.

In IIS 5.0, a workaround that Microsoft does not support or recommend is to add the IWAM_Machinename account to the Operators tab for the SMTP service. This gives the IWAM_Machinename account the correct permissions to the metabase that CDO for NTS (CDONTS) requires.

Note This workaround gives all out-of-process applications access to the metabase, and Microsoft does not recommend this method.

Status

CDONTS was designed to be run as an in-process component through IIS. Typically, the IUSR_Machinename account is given access to the metabase. This account is used by applications that run in-process with IIS. When you run an application out-of-process, it runs from MTS under the IWAM_Machinename account. By default, this account is not given the necessary permissions to the metabase.

This behavior is by design.

More Information

Steps to Reproduce the Behavior

  1. Create an ASP page that uses CDONTS to send mail.
  2. Open the Microsoft Management Console (MMC) for IIS 4.0.
  3. Right-click the root folder or virtual folder in which your page resides.
  4. Click Properties.
  5. Click the Home Directory or the Virtual Directory tab.
  6. Verify that the Run in separate memory space check box is checked.
  7. Run the page.
Properties

Article ID: 286301 - Last Review: Jun 19, 2014 - Revision: 1

Feedback