<%
Option Explicit
Dim sSubject, sBody, oEmail, bSent
If Request.QueryString("email") <> "" Then
'get the correct subject & body text
Select Case Request.QueryString("subject")
Case "lions"
sSubject = "Lions: really big cats"
sBody = "This is what I know about lions."
Case "tigers"
sSubject = "On the subject of tigers:"
sBody = "I can tell you this about tigers."
Case "bears"
sSubject = "So you want to learn about bears?"
sBody = "What is a bear anyway?"
End Select
'create email object, set its properties
Set oEmail = Server.CreateObject("CDONTS.NewMail")
oEmail.To = Request.QueryString("email")
oEmail.From = "me@mysite.com"
oEmail.Subject = sSubject
oEmail.Body = sBody
oEmail.Send
'clean up
Set oEmail = Nothing
'show the confirm page
bSent = true
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 FINAL//EN">
<html>
<head>
<title></title>
<script name="javascript">
function sendEmail(sSubject) {
sEmail = prompt("Please enter your email address for info on " + sSubject + ":","");
if (sEmail && sEmail.length > 0)
location.href = location.href + "?subject=" + sSubject + "&email=" + sEmail;
}
</script>
<style type="text/css">
</style>
<meta name="author" content="?">
<meta name="keywords" content="?">
<meta name="description" content="?">
</head>
<body onload="">
<% If bSent = false Then %>
Click to get info on subject 1 "lions":
<input type="button" name="" value="Lion Info" onclick="sendEmail('lions');" />
<p />
Click to get info on subject 2 "tigers":
<input type="button" name="" value="Tiger Info" onclick="sendEmail('tigers');" />
<p />
Click to get info on subject 3 "bears":
<input type="button" name="" value="Bear Info" onclick="sendEmail('bears');" />
<% Else %>
Thanks - you'll receive your info momentarily.
<p />
<a href="#" onclick="history.go(-1);">BACK</a>
<% End If %>
</body>
</html>