ASP email script with redirect

I have buit a ASP form using Dreamweaver 8 and an Access database. I'm looking for a mail script that will send a confermation email after submiting the form and then redirecting to a thank you page. My forms are working correctly but I do have to say that I am a novice at ASP. Can you help me out?
elomoAsked:
Who is Participating?
 
bugs021997Commented:
You can even use CDO to send email. You will find its implementations in the link below...

http://www.paulsadowski.com/WSH/cdo.htm


I would suggest you to use CDO over CDONTS.
0
 
thirdCommented:
check the following link,

http://www.w3schools.com/asp/asp_send_email.asp

but I advise you to check what email component is supported by your hosting company . usually they have code snippets on how to send email.
0
 
bugs021997Commented:
--------------------
USING CDONTS
--------------------

I am giving you an example as how to include email in your script and sending the form elements in the mail...

The first thing you need to do is create a formpage.asp page with the code below:

    <form name="YourFormName" method="Post" action="confirmation.asp">
    <table>
    <tr><td>Email: </td>
    <td><input type="text" name="Email" size="50"></td></tr>
    <tr><td>First Name: </td>
    <td><input type="text" name="FirstName" size="50"></td></tr>
    <tr><td>Last Name: </td>
    <td><input type="text" name="LastName" size="50"></td></tr>
    <tr><td>Subject: </td>
    <td><input type="text" name="Subject" size="50"></td></tr>
    <tr><td>Comments: </td>
    <td><textarea name="Comments"></textarea></td>
    </table>
    <input type="submit" name="Submit" value="Submit Form">
    </form>






Next, we create a confirmation.asp page with our CDONTS code as seen below:

    <%
    DIM strEmail, strName, strComments, mail, reply, objMail
    strEmail = request.form("Email")
    strName = request.form("Name")
    strComments = request.form("Comments")

    mail = "YOUR EMAIL ADDRESS HERE"
    reply = request.form("Email")
    Set objMail = Server.CreateObject("CDONTS.NewMail")
    objMail.From = reply
    objMail.Subject = "YOUR SUBJECT MESSAGE HERE"
    objMail.To = mail
    objMail.Body = "Email: " & strEmail & vbCrLf & _
    "Name: " & strName & vbCrLf & _
    "Comments: " & vbCrLf & strComments

    objMail.Send
    Set objMail = nothing

response.redirect("thankYou.asp")
    %>

   
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.