Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating a very simple email register textbox and button

Posted on 2008-06-17
5
Medium Priority
?
195 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 2000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

886 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