Solved

Attaching a word doc in asp email code

Posted on 2004-04-30
7
702 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now