Solved

CDONTS attachfile problem

Posted on 2001-06-25
11
300 Views
Last Modified: 2007-11-27
My code looks something like this :-

spic = Request.Form("file1")
dim mail
set mail=server.CreateObject("CDONTS.Newmail")
mail.from = semail
mail.To = "adit@cdgmmp.com"
mail.subject = "Joke Submitted"
mail.Body = "Picture Attached"
mail.AttachFile(spic)
mail.send

spic variable has the correcct file name from the
<input type=file name=file1>

the attachfile is giving the specified error :-

error '80004005'
Unspecified error

Can anyone help ?/
0
Comment
Question by:zombeen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
11 Comments
 
LVL 20

Expert Comment

by:Silvers5
ID: 6224050
yes.. the path should be on the server. you are supplying a path that the user submitted.. if you want to email a picture from the client.. you should first upload the picture to the server then attache it, www.aspupload.com is a good free uploading component.. others exists too..
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 6224055
something like:
spic = "C:\inetpub\wwwroot\images\pic.gif"

or

spic = server.mappath("images\pic.gif")

rgrds
0
 
LVL 2

Author Comment

by:zombeen
ID: 6226260
But Dilvers5, I've seen a program which shows using absolute path from users machine to email an attachment.

Are u absolutely sure that it doesnot work that way ?

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:weesiong
ID: 6226362
zombeen,

IF you want attacment a file and upload to server using CDonts, try this:

http://support.microsoft.com/support/kb/articles/q266/4/52.asp

In first case, you need to upload the file to server site, and server site just can attachment the file to reciepient

Regards,
Wee Siong
0
 
LVL 2

Author Comment

by:zombeen
ID: 6226442
Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
myMail.From = "Example@microsoft.com"
myMail.To = "Someone@microsoft.com"
myMail.Subject = "Sample Message"
myMail.Body = "This is a sample message."
myMail.AttachFile "d:\sample.txt"
myMail.Send
Set myMail = Nothing
 
This following program has been copied from MSDN reference and it clearly shows the use of attachfile without having to upload it first
0
 
LVL 7

Expert Comment

by:weesiong
ID: 6226466
zombeen,

Yes, if the file in the server pc, sure you are no need to upload any files, but now the problem is you need to allow client attachment a file in client site and send it to reciepient. So in first you need upload the file to server site pc, and attachment, and send, and del the temp file.

Got the key?

Regards,
Wee Siong
0
 
LVL 2

Author Comment

by:zombeen
ID: 6226516
Okay, I'll try out the uploading first and then proceed
0
 
LVL 7

Expert Comment

by:weesiong
ID: 6226521
zoombeen,

see the link i sent to you, i no try it, but it is from microsoft website, must good a solution to do this :)

Regards,
Wee Siong
0
 
LVL 20

Accepted Solution

by:
Silvers5 earned 50 total points
ID: 6226575
How do I upload files from the client to the server?

Uploading typically requires a component, either the posting acceptor from Microsoft, ASPUpload from http://www.aspupload.com/, SAFileUp from http://www.softartisans.com, ActiveFile from http://www.infomentum.com/activefile/, or ScriptUtilities from http://www.pstruh.cz/help/ScptUtl/library.htm (which also has "PureASP" -- a way to upload without a component).
 
My personal preference is ASPUpload because of its excellent documentation and its additional methods to change permissions, attributes and ownership of files the instant they're uploaded. It also supports access to the Form collection, while many other solutions do not.
 
Most components come with documentation on the form and script required to make the upload happen.


when you upload you use cdonts:



<%
    Set MailObject = Server.CreateObject("CDONTS.NewMail")
    att_file="c:attachmentsStandardPolicy.txt"
    f_name="Policy.txt"
    MailObject.From="from@me.com"
    MailObject.To="to@me.com"
    MailObject.Subject="Subject Text Here"
    MailObject.Body="Body Text Here"
    MailObject.AttachFile att_file,f_name
    MailObject.Send
%>
 


where the file resides on the server.. you need to give the IUSR read permissions over the attache file or you'll get a permision denied error
0
 
LVL 2

Author Comment

by:zombeen
ID: 6227509
I just found out that my webserver has SiteGalaxy Upload , so i'm trying to use it and then use AttachFile method.

I'll get back tomorrow once I do this
0
 
LVL 2

Author Comment

by:zombeen
ID: 6230125
Thanks , You were right . I had to first upload it and then I could accompalish the task.

Thanks once again
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weighted Randomizing 6 38
window close link 7 58
Html split(text) 2 45
JS to redirect to prev page 8 43
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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