Solved

How to send a form request to an email

Posted on 2012-03-17
7
314 Views
Last Modified: 2012-08-14
Hi All,

   I am designing a webpage where in Contacts page, I ask them to submit their details with first name, last name, email, phone number and note and then click submit. When they click submit button, the data should be delivered to an email.

  Any Ideas. Help greatly appreciated.

Thanks
Aman Khan
0
Comment
Question by:amankhan2005
7 Comments
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 250 total points
ID: 37733366
You will use CDO email http://www.paulsadowski.com/wsh/cdo.htm

<%
' this is a basic sample.  I would suggest implementing a captcha and something to scrub html for when you do get spam.  Please check the link for specific examples.  Also you may need to make a few tweaks depending on your hosting.  However, if you send an email "from" the same domain the form sits on, this should work.  If you do need to authenticate, those examples are in the link.

if request.form("somefield")="xyz" then ' send email to me

first_name = request.form("first_name")
last_name = request.form("last_name")
email = request.form("email")
phone = request.form("phone")
note =request.form("note")

'set up the message body
theBody = "New web lead! sent "&now()&"<br>
theBody = theBody& "First: "&first_name&"<br>"
theBody = theBody &"Last: "&last_name&"<br>"
theBody = theBody &"Email: "&email&"<br>"
theBody = theBody &"Phone: "&phone&"<br>"
theBody = theBody &"Note:<br>"&note&

'now send it
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "From Form xyz re: "& first_name&" "&last_name
objMessage.From = "realemail@mydomain.com"
objMessage.To = "anyemail@anydomain.com"
objMessage.TextBody = theBody
objMessage.Send



end if

%>
0
 
LVL 7

Expert Comment

by:markmiddlemist
ID: 37733729
In asp.net the usual way is to use the System.Net.Mail.MailMessage class

There are good examples on the MSDN page - http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx
0
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 37734182
Here is another way without using the server. It uses html form:
http://www.tizag.com/htmlT/forms.php
You can test it here:
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_mail
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 14

Expert Comment

by:quizwedge
ID: 37750209
Not sure if you're looking for ASP or ASP.NET.

For ASP.NET, use the system.net.mail class that markmiddlemist recommended. If you run into any problems, check out http://www.systemnetmail.com/ It's got a TON of information.

If you're using classic ASP, it depends on what your host offers. A more concise set of examples is at https://help.brinkster.com/KB/a8/how-do-i-send-an-email-with-asp.aspx and a more thorough article is at http://www.devarticles.com/c/a/ASP/Sending-Email-From-a-Form-in-ASP/
0
 
LVL 1

Expert Comment

by:designedbyjackie
ID: 37750321
I built mine using PHP. It is really easy. What is your hosting platform. Is this a static site, or a wordpress site.

There are a ton of basic form widgets for wordpress that you can download and install for free
0
 

Author Comment

by:amankhan2005
ID: 37770692
My Platform is LINUX.

Please find my html file attached where I want to send this form data to an email.

Help Appreciated.
contact.html
style.css
0
 
LVL 1

Accepted Solution

by:
designedbyjackie earned 250 total points
ID: 37772255
I have attached my 2 contact pages so you can see the script and how it works.
This script will run on Linux no problem.. The files are .php

Contact.php is a basic form, no capacha or any bells and whistles.

contactus.php is where all the magic happens and you would just edit the first line $myemail to your email addy.
contact.php
contactus.php
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now