|
||
|
(408) 226 - 5155 | |
|· Supporting Microsoft FrontPage
· | Visual InterDev ·| Database Connectivity | · Active Server Pages ·| |
||
Send email using ASP and the CDONTS.NewMail Object
STEP 1: Create a form page
| <html> <head> <title>Sample Form Page</title> </head> <body> <p>Sample Form Page</p> <form action="sendmail.asp" method=post> <p>Name <input type="text" size="20" name="Name"></p> <p>Phone <input type="text" size="20" name="Phone"></p> <p>Email <input type="text" size="20" name="Email"></p> <p><input type="submit" value="Submit" name="B1"></p> </form> </body> </html> |
STEP 2: Create the mailing script. Call this file sendmail.asp
| <% response.buffer = true message = "The following data was submitted:" message = message & vbcrlf & vbcrlf for each item in request.form message = message & item & ": " & request.form(item) & vbcrlf next set mailer = server.createobject("CDONTS.NewMail") mailer.subject = "Message from website" mailer.from = request.form("email") mailer.to = "myname@mydomain.com" '<---Put your email address here mailer.body = message mailer.send set mail = nothing response.redirect("thankyou.htm") '<--Put your confirmation page here %> |