Link to home
Start Free TrialLog in
Avatar of zombeen
zombeen

asked on

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 ?/
Avatar of Michel Sakr
Michel Sakr
Flag of Canada image

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

or

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

rgrds
Avatar of zombeen
zombeen

ASKER

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 ?

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
Avatar of zombeen

ASKER

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
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
Avatar of zombeen

ASKER

Okay, I'll try out the uploading first and then proceed
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
ASKER CERTIFIED SOLUTION
Avatar of Michel Sakr
Michel Sakr
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zombeen

ASKER

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
Avatar of zombeen

ASKER

Thanks , You were right . I had to first upload it and then I could accompalish the task.

Thanks once again