This is a basic example of an ASP script that will send the results of any form that uses the POST method to an e-mail address.
NOTE: ASP controls the order in which form items are passed to the script. To keep the form items in a logical order would require extra processing and would limit the types of forms that could be used.
<% set mailer = server.createobject("SMTPsvg.Mailer") Mailer.FromName = "From E-mail Name" Mailer.FromAddress = "fromaddress@mysite" Mailer.RemoteHost = "mail-out.rapidsite.net" Mailer.AddRecipient "Your Name Here", "Your E-mail Address Here" Mailer.Subject = "Forms2Email" For each Item in Request.Form ' Loop through each Form item strMsgInfo = strMsgInfo & Item & ": " & Request.Form(Item) & vbCrLf next strMsgHeader = "Form information follows" & vbCrLf & "*************" strMsgFooter = vbCrLf & "*************" Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter if Mailer.SendMail then Set Mailer = Nothing ' Message sent Ok, redirect to a confirmation page Response.Redirect ("http://mysite/confirm.htm") else Set Mailer = Nothing ' Message send failure Response.Write ("An error has occurred.<BR>") ' Send error message Response.Write ("The error was " & Mailer.Response) end if %>
Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!
Copyright © 1996-2024, Integrated Technical Solutions, Inc., all rights reserved. See Terms/Legal for trademarks, copyright, and terms of use.
Naperville, IL 60563
fax 630.420.2771