Solved

Creating a very simple email register textbox and button

Posted on 2008-06-17
5
182 Views
Last Modified: 2013-11-19
I would like to know the code i could use to have  a textbox on my website that a user can put in their email address in, click on a button that says "register"  and then have the email of the user sent to another email account of my choosing.

The idea is to create a registration list of emails that will be stored in an email that I own.

The only requirements i need is

1. A text box
2. A button that sends the info found in the text box to a email
3. That it works in xhtml 1.0 stict and css


0
Comment
Question by:djmichaelray
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 21805703
Save the code below as hielo.asp and try it. You will need to provide a valid email address.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<%
If "Register" = Trim(Request.Form("register")) Then
	Set myMail=CreateObject("CDO.Message")
	myMail.Subject="Sending email with CDO"
	myMail.From="mymail@mydomain.com"
	myMail.To="someone@somedomain.com"
	myMail.TextBody=Request.Form("email")
	myMail.Send
	set myMail=nothing
	Response.Write("<h1>Thank You</h1>")
Else
%>
<form action=<%=Request.ServerVariables("SCRIPT_NAME")%>' method="post" onsubmit="if(email.value==''){alert('Please provide email');return false;}">
	<div>
		<div>Email: <input type="text" name="email" id="email" /></div>
		<div><input type="submit" name="register"  value="Register"/></div>
	</div>
</form>
<%
End If
%>
</body>
</html>

Open in new window

0
 

Author Comment

by:djmichaelray
ID: 21805828
thanks alot looks great. One last question.  Will i encounter anyproblems implementing a asp page insteam of html into my current css design
0
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 21805866
It makes not difference if the page is html or asp. The potential problems you would encounter would be based on the HTML content that the browser sees/receives. An ASP file contains SERVER code AND (typically) HTML code. The browser does NOT see/receive the SERVER code, so the ASP code will not affect your page. The only thing that will affect your page is the output of the ASP page - meaning the overall data that the asp sends to the browser.
0
 

Author Closing Comment

by:djmichaelray
ID: 31468061
Thanks alot for the attension to deatil in your explanation
0
 
LVL 82

Expert Comment

by:hielo
ID: 21805950
You are welcome!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 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