navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

ASP cdo email attachment

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> ASP cdo email attachment
Page: [1]
 
chobo321321

 

Posts: 66
Joined: 6/5/2004
Status: offline

 
ASP cdo email attachment - 11/13/2004 3:28:57   
Hi, I'm trying to create a form where people can upload small files in an email attachment.

For the form I just have 2 textboxes, 1 file browse component, and a submit button. Here's the asp script I'm using. I added the response write statements to see if it grabs the field content which is does, but the file attachment path doesn't inlcude the drive letter in the name.

When I run the script I get the following error which points to the
"objCDOSYSMail.AddAttachment strAttachment" line.

CDO.Message.1 error '800c000d'

<%@LANGUAGE="VBSCRIPT">
<%
'Dimension variables
Dim objCDOSYSCon
Dim strEmail, strWebsite, strAttachment

strEmail = Request.Form("email")
strWebsite = Request.Form("website")
strAttachment = Request.Form("attachment")

Response.Write "From: " & strEmail & "<br />"
Response.Write "From: " & strWebsite & "<br />"
Response.Write "From: " & strAttachment & "<br />"

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")  
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.easy-answers.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = strEmail
objCDOSYSMail.To = "chobo321321@work.com"
objCDOSYSMail.Subject = "Application Help"
objCDOSYSMail.TextBody = strWebsite
objCDOSYSMail.AddAttachment strAttachment
objCDOSYSMail.Send

'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP cdo email attachment - 11/13/2004 13:40:50   
strAttachment needs to be of the type "c:\folder\file.name", the full path to the file.

eg - depending on the location of the file :
.AddAttachment Server.Mappath(strAttachment )


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to chobo321321)
chobo321321

 

Posts: 66
Joined: 6/5/2004
Status: offline

 
RE: ASP cdo email attachment - 11/13/2004 16:41:27   
I added the line, and I get the following error message:

From: chobo@hotmail.com
From: www.test.com
From: testing.htm

CDO.Message.1 error '80070002'

The system cannot find the file specified.

/exp/apply.asp, line 32

I think it is checking for the file on the server, and not my machine. I also have a problem with the following line on the form enctype="multipart/form-data". When I put this line in the form the response.write statements will be blank. Once I take it out it displays whats in those fields.


(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP cdo email attachment - 11/13/2004 16:49:46   
Yes, the file needs to exist on your server and be uploaded first.

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to chobo321321)
chobo321321

 

Posts: 66
Joined: 6/5/2004
Status: offline

 
RE: ASP cdo email attachment - 11/13/2004 17:04:39   
The form I'm trying to make enables users to browse their computer for a file(graphic one), and send it via email attachment. I'm kinda lost as to how I should go about this.


(in reply to Spooky)
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP cdo email attachment - 11/14/2004 13:17:08   
Check out something like Lewis Motens uploader from http://www.lewismoten.com/LewiesCodeLibrary/Details.htm?folder=ASP/UploadFilesWithoutCOMv3

Itll enable you to upload the file to the web server so it can be attached.

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to chobo321321)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> ASP cdo email attachment
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts