Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 29th, 2008, 03:46 PM
Authorized User
Join Date: Nov 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to mail btowse files as an attachment

I have one html page with 3 textbox controls,1 input file control and submit button.When the submit utton is clicked it should go to asp page and perform the operation.

What i want is that when the user fills the textbox controls and browse the file, the uploaded file should be maild as an attachment along with the filled values.That is when the user receives the mail he should see the textbox values(ie firstname,lastname,email,address) along with the uploaded files as an attachment.

How to do this?

Old April 30th, 2008, 08:56 AM
Friend of Wrox
Join Date: Dec 2006
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post


The way i do it is in the file upload process extract the filename and add as a hidden form input.

Then in your cdo page, reference the filename in the objMessage.AddAttachment line.

body.asp (Template used for body of email in html format)

<tr><td><%=request("firstname ")%></td></tr>
<tr><td><%=request("lastname ")%></td></tr>
<tr><td><%=request("email ")%></td></tr>
Cdo Page


Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "Subject" 
objMessage.From = "your send address" 
objMessage.To = ""& email &""
objMessage.CreateMHTMLBody("http://yoursite/templates/body.asp"& _
"?firstname=" & firstname & ""& _
"&lastname="& lastname & ""& _
"&email=" & email & "")

set objMessage=nothing

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to mail uploaded files as an attachment jijish Classic ASP Professional 0 April 29th, 2008 03:35 PM
Mail attachment surendran PHP How-To 0 August 3rd, 2006 06:05 AM
mail with attachment in JAVA rekha_jsr Servlets 8 March 10th, 2006 07:39 AM
mail-attachment sureshdev786 General .NET 0 December 27th, 2004 09:34 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.