Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Emailing a form

Status
Not open for further replies.

sharris

Programmer
Dec 11, 2002
10
US
How do I email a form when the submit button is clicked? We have not linked up to a database yet and I am trying to at least have an order form emailed to us when the customer clicks the submit button after filling in the form. Any clues?
 
Here you go...

Have your email form submit to this page (call it whatever you want.asp)



'**********************************************

<%
Dim objMail
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

HTML = HTML & &quot;<HTML>&quot;
HTML = HTML & &quot;<HEAD>&quot;
HTML = HTML & &quot;<TITLE>Send Mail with ASP</TITLE>&quot;
HTML = HTML & &quot;</HEAD>&quot;
HTML = HTML & &quot;<BODY bgcolor=&quot;&quot;white&quot;&quot;>&quot;
HTML = HTML & &quot;<TABLE cellpadding=&quot;&quot;4&quot;&quot;>&quot;
HTML = HTML & &quot;<TR><TH><FONT color=&quot;&quot;darkblue&quot;&quot; SIZE=&quot;&quot;4&quot;&quot;>&quot;
HTML = HTML & &quot;Some TEXT goes here</FONT></TH></TR>&quot;
HTML = HTML & &quot;<TR><TD>&quot;
HTML = HTML & &quot;</FONT></TD></TR></TABLE>&quot;
HTML = HTML & &quot;</BODY>&quot;
HTML = HTML & &quot;</HTML>&quot;

objMail.From = request.form(&quot;emailfield&quot;)'The From field could be anything you want, it does not have to be an actual email address if you don't want to. Be sure to let the user know this is an automated email tho.
objMail.Subject = &quot;Email after filling out the form&quot;

objMail.BodyFormat = 0
objMail.MailFormat = 0

objMail.To = request.form(&quot;user.email.from.form&quot;)
objMail.Body = HTML
objMail.Send

set objMail = nothing
response.redirect &quot;AnyPage.asp&quot;
%>





winlogo.gif
cool.gif

ASP Questions? go to:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top