Solved

Attaching a word doc in asp email code

Posted on 2004-04-30
7
704 Views
Last Modified: 2008-01-16
I am puzzled experts.

My asp code is dumping the contents of a db file into a word doc and
then creates a file on the web root directory per code below.

Problems I am running are:

1, If I created a field name called filename on the db specifically to be the name of doc file being create.
I then hardcoded the value for this field.
The whole idea is when this file is created on a folder, it will have that name like notify.doc

When I run this one line of code below, I get the error permission denied.

file_being_created= rs("filename") & ".doc"

Microsoft VBScript runtime (0x800A0046)
Permission denied

I don't know why because code below should overwrite a doc file if it already exists.

Set act = fso.CreateTextFile(server.mappath(file_being_created), true)


The other error occurs when I change file_being_created to autonumber on the db.
If I change the file_being_cr
file_being_created= rs("ID") & ".doc"
CDO.Message.1 (0x80070002)
The system cannot find the file specified.



Flds.Update
With iMsg
 Set .Configuration = iConf
     .From = "web Admin <domain.com>"
     .To = "domain.com"
     .AddAttachment("\\dw6\Reports\file_being_created")
     .AddAttachment("\\dw6\Reports\logo.gif")
     .Sender      = "web Admin <domain.com>"
     .Subject     = "New Information"
     .TextBody    = "Attached is a word document added to the database. "
       .Send
End With

Any help would be appreciated.
0
Comment
Question by:simflex
  • 4
  • 3
7 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10963906
Do the IUSR_ and IWAM_ accounts have READ/WRITE access to this directory?

FtB
0
 

Author Comment

by:simflex
ID: 10976660
hi Fritz!
My response is coming late because I couldn't gain access to our network this past weekend.
So rather than guess an answer to your question, I decided to wait to verify first.
In any case, the answer to your question is yes.
Again, when I use autonumber, instead of the filename I created on the db, I get an error that system could not find file.
I get that error message because the .doc file was not getting created.
If I use the filename, I get an error that permission is denied.
Either way, I am not being allowed to create this file.
Any help in resolving this would be greatly appreciated.
I am giving a demo this pm and so it would be great if I could show them that this is working.
0
 

Author Comment

by:simflex
ID: 10985933
can anyone here please assist me with this problem?
Thanks in advance
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10986410
As I said above, if the IUSR and IWAM don't have proper permissions, the file will not get written.

FtB
0
 

Author Comment

by:simflex
ID: 10995446
I have given IUSR and IWAM accounts full permissions on everything but yet I still get this error:

Error Type:
CDO.Message.1 (0x80070020)
The process cannot access the file because it is being used by another process.
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 50 total points
ID: 10995577
That is progress, I suppose. At least know the file is being created. Can you verify that is the case by watching the appropriate directory on your server?

Fritz the Blank
0
 

Author Comment

by:simflex
ID: 10995861
Yes, the file is being create.
The hangup now is getting my email program to pick it up and send it out.
That is where the problem is right now.
Thanks for the assistance
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question