Click to See Complete Forum and Search --> : aspemail question.


FlagstaffRoy
10-15-2006, 11:45 AM
I have written my form to work with aspmail. However, I want to reroute sender to my ThankYou page. Would Response.Redirect work in aspmail?

<%
' change to address of your own SMTP server
strHost = "10.1.1.181"
strRecepient = "myaddress@yahoo.com"

If Request("Send") <> "" Then

Set Mail = Server.CreateObject("Persits.MailSender")
' enter valid SMTP host
Mail.Host = strHost

Mail.From = Request("txtFirstName")
' & " " & Request("txtLastName")
Mail.AddAddress strRecepient

' message subject
Mail.Subject = "Information Request"
' message body
Mail.Body = "ONLINE REQUEST INFORMATION: " & vbcrlf & "==================================================================" & vbcrlf & "Financing Info: " & Request("chkFinancing") & vbcrlf & "FloorPlans Info: " & Request("chkFloorPlans") & vbcrlf & "Spanish Help: " & Request("chkSpanish") & vbcrlf & "First Name: " & Request("txtFirstName") & vbcrlf & "Last Name: " & Request("txtLastName") & vbcrlf & "Phone: " & Request("txtPhone") & vbcrlf & "Comment: " & Request("txtComment") & vbcrlf & "Email: " & Request("txtEmail") & vbcrlf & "Address: " & Request("txtAddress") & vbcrlf & "City: " & Request("txtCity") & vbcrlf & "State: " & Request("selState") & vbcrlf & "Zip: " & Request("txtZip") & vbcrlf & "Want to move to new house within: " & Request("timeline")

strErr = ""
bSuccess = False
On Error Resume Next
Mail.Send
If Err <> 0 Then
strErr = Err.Description
else
bSuccess = True
End If
End If

Response.Redirect "Thankyou.html"
%>

FlagstaffRoy
10-15-2006, 12:37 PM
I just moved response.Redirect after mail.send and now it works....