ASP email script with redirect

Posted on 2007-07-20
Last Modified: 2010-04-25
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?
Question by:elomo
    LVL 30

    Expert Comment

    check the following link,

    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.
    LVL 14

    Expert Comment


    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">
        <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>
        <input type="submit" name="Submit" value="Submit 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

        Set objMail = nothing


    LVL 14

    Accepted Solution

    You can even use CDO to send email. You will find its implementations in the link below...

    I would suggest you to use CDO over CDONTS.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now