Solved

CDONTS attachfile problem

Posted on 2001-06-25
11
288 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
  • 5
  • 3
  • 3
11 Comments
 
LVL 20

Expert Comment

by:Silvers5
Comment Utility
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
Comment Utility
something like:
spic = "C:\inetpub\wwwroot\images\pic.gif"

or

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

rgrds
0
 
LVL 2

Author Comment

by:zombeen
Comment Utility
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
 
LVL 7

Expert Comment

by:weesiong
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Expert Comment

by:weesiong
Comment Utility
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
Comment Utility
Okay, I'll try out the uploading first and then proceed
0
 
LVL 7

Expert Comment

by:weesiong
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks , You were right . I had to first upload it and then I could accompalish the task.

Thanks once again
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

7 Experts available now in Live!

Get 1:1 Help Now