The first thing you need to do is create a formpage.asp page with the code below:
Next, we create a confirmation.asp page with our ASPEmail code as seen below:
<% DIM strEmail, strFirstName, strLastName, strSubject, strComments, Mail strEmail = request.form("Email") strFirstName = request.form("FirstName") strLastName = request.form("LastName") strSubject = request.form("Subject") strComments = request.form("Comments") DIM Mail, strMsgHeader Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "mail.aspwebpro.com" Mail.From = strEmail Mail.AddAddress "general@aspwebpro.com" Mail.AddCC "general@aspwebpro.com" Mail.Subject = "ASP Web Pro: Online Form" strMsgHeader = "This email was delivered from the ASP Web Pro website." & vbCrLf & vbCrLf Mail.Body = strMsgHeader & "Email: " & strEmail & vbCrLf & _ "First Name: " & strFirstName & vbCrLf & _ "Last Name: " & strLastName & vbCrLf & _ "Subject: " & strSubject & vbCrLf & vbCrLf & _ "Comments: " & vbCrLf & strComments On Error Resume Next Mail.Send Set Mail = Nothing IF Err <> 0 THEN
Response.Write "There has been an error and your message could not be sent through email. Please contact us directly at 1-716-768-6221. " & Err.Description
END IF
%>
<% Response.Write strFirstName & ",
"
Response.Write "Your message has been successfully sent."
%>,
Now you have a complete form that sends data to an email address and displays a customized message for your user. The default format for ASPEmail is to send plain text messages. If you want to send HTML messages with ASPEmail, you can simply include this extra line of code before the Mail.Body line.
Mail.isHTML = True
Enjoy!
http://www.aspwebpro.com/aspscripts/email/aspemail.asp
No comments:
Post a Comment