[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP email script with redirect

Posted on 2007-07-20
3
Medium Priority
?
170 Views
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?
0
Comment
Question by:elomo
  • 2
3 Comments
 
LVL 30

Expert Comment

by:third
ID: 19536836
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
 
LVL 14

Expert Comment

by:bugs021997
ID: 19537492
--------------------
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
 
LVL 14

Accepted Solution

by:
bugs021997 earned 500 total points
ID: 19537503
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

831 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