Solved

How to send a form request to an email

Posted on 2012-03-17
7
324 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 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 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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 Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
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.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

729 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