Solved

CDONTS attachfile problem

Posted on 2001-06-25
11
297 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
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
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!

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

735 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