?
Solved

How to send a form request to an email

Posted on 2012-03-17
7
Medium Priority
?
328 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 53

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1000 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 36

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 1000 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

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

764 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