Connecting Tech Pros Worldwide Help | Site Map

CDO.Message.1 error '80070005' Access is denied. /emailtest.asp, line 9

Newbie
 
Join Date: Aug 2009
Posts: 1
#1: Aug 3 '09
I am trying to use CDO to send email with attachments using the following code:
Expand|Select|Wrap|Line Numbers
  1. Dim myMail
  2.         Dim mFile1
  3.         mFile1="c:\images\a.gif" 'valid file path, file actually exists
  4.             Set myMail=CreateObject("CDO.Message")
  5.             myMail.Subject="some subject"
  6.             myMail.From=mUserEmail      'valid email address
  7.             myMail.to= mRecipientEmail   'valid email address
  8.             myMail.HTMLBody = "some text"
  9.             myMail.AddAttachment mFile1
  10.             myMail.Send
  11.             set myMail=nothing
1. I get the following error at 'myMail.AddAttachment mFile1' line of the code.

CDO.Message.1 error '80070005'
Access is denied.
/emailtest.asp, line 9

2. Emails without attachments get sent successfully.

3. Even with attachments,code works fine at my devlopment workstation where I have admin rights. However error is produced in other workstations where I do not have admin rights.

How can I solve this problem.

Thanks,
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#2: Aug 4 '09

re: CDO.Message.1 error '80070005' Access is denied. /emailtest.asp, line 9


It seems pretty obvious to me....you seem to already know the answer your question. You need to apply the proper permissions to allow your code to use the resource.

The account that is executing the code has to have permissions to use the resource.

Either set permissions on the resource to allow the ASP anonymous user account access to the resource.

Or

Create a user account that has permissions to access the resource and then use impersonation.

Or

If you're using windows authentication at all, ensure that the user account which is using the application has permission to user the resource.

-Frinny
Reply

Tags
access denied, attachment, cdo, email, error '80070005


Similar ASP.NET bytes