<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>print and email form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005, 2006 Roderick Divilbiss">
</head>
<body>
<form method="POST" action="printandemailform1.asp" name="frmEntry">
<p>Name <input type="text" name="name" size="40"><br>
Email <input type="text" name="email" size="50"><br>
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
<%
Dim objMessage, item, strBody, toAddress, resultMessage
toAddress = request.form("email")
if toAddress = "" then
response.write "There is no to address"
response.end
end if
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example Emailed Form"
objMessage.From = "postmaster@rodsdot.com"
objMessage.To = toAddress
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.TextBody = "Name: " & request.form("name") & chr(10)
objMessage.TextBody = objMessage.TextBody & "E-Mail: " & request.form("email") & chr(10)
on error resume next
objMessage.Send
if error then
resultMessage = err.number & " " & err.description & " " & err.source
else
resultMessage = "Message sent. Please check your inbox."
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005, 2006 Roderick Divilbiss">
<title>rodsdot.com :: print and email form handler</title>
</head>
<body>
<p>Thank you for you form submission:</p>
<p>You entered...</p>
<p>Name: <%=request.form("name")%></p>
<p>E-Mail: <%=request.form("email")%></p>
<p>[<a href="javascript:window.print();">print for your records</a>]</p>
</body>
</html>
© Coyright 2000-2008, Roderick (Rod) W. Divilbiss. Some rights reserved.
Except where otherwise noted, this site, all content, and all source code and markup is licensed under a Creative Commons License
Creative Commons License.
No part of this web site including all application code and examples may be used for commercial purposes without prior written permission from the author,
Roderick W. Divilbiss of Overland Park, Kansas, United States of America.