We help IT Professionals succeed at work.

form submissions to email

FrancoisBonthuys
on
268 Views
Last Modified: 2010-04-09
How do you send a form's(html) results to a specific email address?

e.g: the user type in his/her personal info in a registration form. When the submit button is clicked, the info must be automatically sent to a certain email address in our company
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
If you're running IIS and the server has SMTP mail enabled, you can use CDONTS.  As an example:

<%
    Dim MyBody
    Dim MyCDONTSMail
%>

<%
    Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    MyCDONTSMail.From= request.form("them@theirserver.com")
    MyCDONTSMail.To= "theguyinside@yourcompany.com"
    MyCDONTSMail.Subject="Stuff from the form"
    MyBody = "I put in the form" request.form("formfield") & vbCrLf
    MyBody = MyBody & "and here it is.
    MyCDONTSMail.Body= MyBody
    MyCDONTSMail.Send
    set MyCDONTSMail=nothing
%>

- modified from http://www.powerasp.com/content/hintstips/asp-email.asp

Commented:
You can try this..

at your <form> tag add the action to email

ie. <form action="mailto:emailaddresshere">

then at the button just use a simple submit button

ie. <input type="submit" value="valuehere">

Commented:
You can try mailto - but as has been pointed out already, its is exceptionally unreliable so doing so is a very bad idea.
The best way I have been able to find is to use ASP.  Below is a sample of 2 files which are necessary to do it this way.  The first is form.html which goes to form_process.asp when submit is clicked.

form.html:
<form name="form" method="POST" action="form_process.asp">
<input type="text" name="fName" size="20">
<input type="text" name="lName" size="20"><br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="reset">
</font>

form_process.asp

<%@Language=VBScript%>
<%
mailbody="<HTML>" & _
"<body bgcolor='#FFFFE8' text='#000000'>" & _
"<div align='center'>" & _
"<font face='verdana' size='4'>" & _
"<b>Form Name<br>" & _
"</font>" & _
"</div>" & _
"<br><br>" & _
" " & request.Form("fName") & _
" " & request.Form("lName") & _
" "
Dim recipiant
recipiant = "email@company.com"
Set Mail = Server.CreateObject("CDONTS.NewMail")
Mail.From = request.Form("email")
Mail.To = recipiant
Mail.Subject = "Form Name"
Mail.Body  = mailbody
Mail.BodyFormat = 0
Mail.MailFormat = 0
Mail.send
set mail = Nothing

response.Write("<html>")
response.Write("<body bgcolor='#FFFFE8' text='#000000'>")
response.Write("<div align='center'>")
response.Write("<font size='4'>")
response.Write("<b>THANK YOU</b>")
response.Write("<br><br>")
response.Write("<br>Your responses have been submitted.<br>")
response.Write("We appreciate you taking time to complete this form.")
response.Write("</font>")
response.Write("<br><br>")
response.Write("<a href='http://www.somepage.com'>Go to Some Page</a>")
response.Write("</div>")
response.Write("</body>")
response.Write("</html>")

The last part is optional. If you want you can just have it go right back to the form or any other page by putting:

response.redirect("http://womepage.com")

Hope this helps.

judoscott

Commented:
Hello FrancoisBenthoys. I have a good HTML code for you. you can easily put in your e-mail address in to the <form action="mailto:username@service.com?subject=Affiliation" method="post" enctype="text/plain">

Heres the code:
--------------------
<font size="3" face="Stop">
<form action="mailto:emjay110@hotmial.com?subject=Affiliation" method="post" enctype="text/plain">
  <p><font color="#336699"><b><font size +10>
  <input type="name" value="Name:" size="20" name="1"><br>
  <input type="webpage" value="Last Name:" size="20" name="2"><br>
  <input type="age" value="Age:" size="20" name="3"><br>
  <input type="Hits/perday" value="Address:" size="20" name="4"><br>
  <input type="allhits" value="Postal Code:" size="20" name="5"><br>
  <input type="submit" value="Submit" style="color: rgb(255, 255, 255); background-color: rgb(51, 102, 153);">
  </font></b></font></p>
  </font>
</form>

</body>

</html>
--------------------
Go ahead and try it.

If you need more help on your website you can e-mail me at zeyad_abdulghani@hotmail.com

"""I'm fully advanced!"""

Commented:
Oh yea, this is a short code, however this would work if the user is sending his/her information using her specific e-mail program like Outlook. When clicking the submit button, his/her Outlook will automatically send the information that were typed in the text boxes, or combo boxes on your site to your e-mail. You can change your e-mail.

If you edit the form in Frontpage 2000 or beyond, you should see a visible outline on the whole form. You can add other features like radio buttons, check buttons and it will simply work. You can add as many of them as u like.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.