Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

CDONTS attachfile problem

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
zombeen
Asked:
zombeen
  • 5
  • 3
  • 3
1 Solution
 
Michel SakrCommented:
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
 
Michel SakrCommented:
something like:
spic = "C:\inetpub\wwwroot\images\pic.gif"

or

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

rgrds
0
 
zombeenAuthor Commented:
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
Industry Leaders: 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!

 
weesiongCommented:
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
 
zombeenAuthor Commented:
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
 
weesiongCommented:
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
 
zombeenAuthor Commented:
Okay, I'll try out the uploading first and then proceed
0
 
weesiongCommented:
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
 
Michel SakrCommented:
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
 
zombeenAuthor Commented:
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
 
zombeenAuthor Commented:
Thanks , You were right . I had to first upload it and then I could accompalish the task.

Thanks once again
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now