Send Email w/ Attachment from ASP form

This is a discussion on "Send Email w/ Attachment from ASP form" within the Classic ASP section. This forum, and the thread "Send Email w/ Attachment from ASP form are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 7th, 2003, 19:56
New Member
Join Date: Oct 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send Email w/ Attachment from ASP form

Ok, so I have an HTML form that posts to an ASP page. On the HTML page, there is a checkbox for saying if a client wants a brochure emailed to him/her that is a 1.33mb PDF. How can I see when they check this and submit, have it email the PDF automatically?

any clues

thanks

BJ

  #2 (permalink)  
Old Nov 7th, 2003, 20:13
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Checkout the every handy:

http://www.4guysfromrolla.com/webtech/112298-1.shtml

  #3 (permalink)  
Old Nov 7th, 2003, 20:41
Reputable Member
Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
To send an email, I use this function:
Code: Select all
<%
	sub SendEmail(ToMe, FromMe, Blind, Copy, MySubject, MyBody, Attachment)
		Dim MyMail
		Set MyMail = Server.CreateObject("CDONTS.NewMail")
		Dim fs,f

		MyMail.From = FromMe
		MyMail.To = ToMe
		MyMail.BCC = Blind
		MyMail.CC = Copy
		MyMail.Subject = MySubject
		MyMail.Body = MyBody
		MyMail.BodyFormat = 1
		MyMail.MailFormat = 1
		
		if Attachment <> "" then 
			Set fs=Server.CreateObject("Scripting.FileSystemObject")
			Set f=fs.GetFile(Server.MapPath(Attachment))
			MyMail.AttachFile  f
		end if
			
		MyMail.Send
	
'		response.write FromMe & ", " & ToMe & ", " &  Blind & ", " &  Copy & ", " &  MySubject & ", " &  MyBody
		Set MyMail = Nothing
		set f=nothing
		set fs=nothing
	end sub
%>
When you have a checkbox like this:
<input type="checkbox" name="SendPFD" value="true">
on the ASP page, I have found, you have to say
<% if response.form("SendPDF") = True then do some stuff %>

to call the email function
<%
attachment = "string that is the full file location of the file or the relative file location of the file."

sendemail toEmail, FromEmail, BCCEmail, CCEmail, Subject, bodyText, attachment
%>

see this: http://www.w3schools.com/asp/asp_ref_filesystem.asp for more information on the file system object. It took me quite a bit of putzing to get relative file addressing to work, but I did - mostly through trial and error.

I also recommend this site in general for basic ASP and VBScript stuff.

Hope this makes sense
jakyra
  #4 (permalink)  
Old Nov 7th, 2003, 20:44
Reputable Member
Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
or just do what Sirkent said
jakyra
Closed Thread

Tags
send, email, attachment, asp, form

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form send in email Bravo81 PHP Forum 20 Jan 17th, 2008 11:47
Form to Email Photo attachment septemberq Classic ASP 7 Oct 24th, 2007 17:09
PHP Form to send sender an email? gribble PHP Forum 5 Mar 26th, 2007 13:06
Form won't send to email? Inkers Web Page Design 3 Jan 22nd, 2007 16:11
Send form details to an email address...please help! newbie44 JavaScript Forum 4 Oct 2nd, 2005 08:45


All times are GMT. The time now is 22:10.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43