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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a form to post to an email with contents

Status
Not open for further replies.

ariell

Programmer
Jul 3, 2002
12
US
I have created a web page(site) using Dreamweaver MX and I have put the necessary code in place <FORM action=&quot;email addrss&quot; method=&quot;post&quot;, etc... , but this takes me to my email account with name filled in but no text in body. While testing in IE and after loading site to web server. I should not see any pop-up emails to my email account. I should just see the &quot;Thank You&quot;, that I have pop up after sending the email. Which I do in addition to other stuff. Is there something I can code in asp to help this, or is there something other I can put into my code that I may have ommitted?
 
Have your form submit to this page naming it whatever you want keeping in mind that no data is being saved to a database (which is what you would really want) unless you don't want to.


email page
********************************

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<%
dim mystring
mystring = &quot; server/site/page.asp&quot;
%>

<html>
<body>


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

HTML = HTML & &quot;<HTML>&quot;
HTML = HTML & &quot;<HEAD>&quot;
HTML = HTML & &quot;<TITLE>My email Form</TITLE>&quot;
HTML = HTML & &quot;</HEAD>&quot;
HTML = HTML & &quot;<BODY LEFTMARGIN=&quot;&quot;0&quot;&quot; TOPMARGIN=&quot;&quot;0&quot;&quot; bgcolor=&quot;&quot;White&quot;&quot;>&quot;
HTML = HTML & &quot;<TABLE cellpadding=&quot;&quot;4&quot;&quot;>&quot;
HTML = HTML & &quot;<TR><TD>&quot;
HTML = HTML & &quot;<br>&quot;
HTML = HTML & &quot; & &quot;<font color='##003399'>&quot; & Request.form(&quot;message&quot;) & &quot;</font>&quot; & &quot;<br>&quot;
HTML = HTML & &quot;</FONT></TD></TR></TABLE><BR><BR>&quot;
HTML = HTML & &quot;<br>&quot;
HTML = HTML & &quot;</FONT></TH></TR><br><br>&quot;
HTML = HTML & &quot;</BODY>&quot;
HTML = HTML & &quot;</HTML>&quot;

objMail.From = request.form(&quot;from&quot;)
objMail.Subject = request.form(&quot;subject&quot;)

objMail.BodyFormat = 0
objMail.MailFormat = 0

objMail.To = request.form(&quot;to&quot;)
objMail.cc = request.form(&quot;cc&quot;)

objMail.Body = HTML
objMail.Send

%>
<a name=&quot;ovhref&quot; href=&quot;<%=mystring%>&quot;></a>
<script language=&quot;JavaScript&quot;>
ovhref.click()
</script>

********************************
email page


P.S. What I'm doing with the redirect (mystring) is sending the user to a thankyou.asp page and on that page you can redirect them back to your default.asp page if you'd liked.


[sup]I haven't lost my mind, it's backedup on CD somewhere[/sup]
[sup]
rockband.gif
banana.gif

ASP Questions? go to: [/sup]​
 
Wow, did you have this already script? You are good. Thank you and I'll let you know how it works.
 
Short answer: Yes!

I use it all the time so, no need to re-write it just modify it.

glad to help.

[sup]I haven't lost my mind, it's backedup on CD somewhere[/sup]
[sup]
rockband.gif
banana.gif

ASP Questions? go to: [/sup]​
 
I have not tried this but this is for all the information that is received from the form which I created in Dreamweaver? The form name is inputted in the &quot;request.form&quot; you have highlighted in red. By doing so automagically put the information to my email address correct? If so where do I put the receivng email address?
 
ok the email is still going in the form html...
 
On your form.html page you should have the following fields:

[ul][li]From[/li][li]To[/li][li]Cc[/li][li]Subject[/li][li]Message[/li][/ul]

and the form should look something like this:
<form name=&quot;MyForm&quot; method=&quot;post&quot; action=&quot;email.asp&quot;>

------------------------------------------------------------
If this form is being used for your users to fill in and email the &quot;From&quot; field would be your users email address the &quot;To&quot; field your email address and so on...



center][sup]I haven't lost my mind, it's backedup on CD somewhere[/sup][/center][sup]
rockband.gif
banana.gif

ASP Questions? go to: [/sup]​
 
I don't have any of those fields. I have a survey form that asks several questions. Once they click on the SUBMIT button, the form is suppose to take the content of what's in the form and send it to my email address. This is what I want it to do! What I get when I do this with the actions varibale action=&quot;emailaddress&quot;, it opens up the email with no text from the form. I can use what you sent to input that information, but I don't want them to see the pop-up information with the email. Just the thank you after submitting the email address. If I put those labels, to, from, cc etc.. in html doc, will that allow for non-visibility to he email or will it? I guess it really doesn't matter.
 
Replace the fields on my last post and apply the fields you have to the email.asp page. Once this form/survey is submitted, all your uses will see next is the thankyou page.

[sup]I haven't lost my mind, it's backedup on CD somewhere[/sup]
[sup]
rockband.gif
banana.gif

ASP Questions? go to: [/sup]​
 
It seems you know asp very well, with VB. How would you creat a default, login and registration, and default.asp page? I recently brought a book and it looks pretty simple to use.
 
I'd would suggest for you to get started and I like many here would be more than happy to assist you in your asp development.

Try to do as much as possible and when you get stuck, post back..

See this link for a quick sample login/default page:




* * * * * * * * * * *
<%=Tony%>
cold.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top