ASP form with a thank you page and email

xAbysSx

New Member
I have a contact form already built. My boss wants to add a feature where after the client fills out and submits the form, the client then receives a thank you message in their email box.Here is the back end code I'm using:\[code\]<%Dim iMsgDim iConfDim FldsDim EMailBodyDim strSmartHostConst cdoSendUsingPort = 2StrSmartHost = "#"set iMsg = CreateObject("CDO.Message")set iConf = CreateObject("CDO.Configuration")Set Flds = iConf.Fields' set the CDOSYS configuration fields to use port 25 on the SMTP serverWith Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10.UpdateEnd With' Get all variable from frmRegUserProviderName = Request.Form("ProviderName")ProviderType = Request.Form("ProviderType")Address = Request.Form("Address")Address2 = Request.Form("Address2")City = Request.Form("City")State = Request.Form("State")Zipcode = Request.Form("Zipcode")OfficePhone = Request.Form("OfficePhone")YourName = Request.Form("YourName")Address02 = Request.Form("Address02")Address22 = Request.Form("Address22")City2 = Request.Form("City2")State2 = Request.Form("State2")Zipcode2 = Request.Form("Zipcode2")Telephone = Request.Form("Telephone")Email = Request.Form("Email")Member = Request.Form("Member")dim MailSubj MailSubj = "Lead from"' build HTML for message bodyEMailBody = "<HTML>"EMailBody = EMailBody & "<head></head>"EMailBody = EMailBody & "<body>"EMailBody = EMailBody & "<p>Provider Contact Information: " & "<br />"EMailBody = EMailBody & "----------------------------------------------" & "<br/>"EMailBody = EMailBody & "-------Practitioner Information--------" & "</p>"EMailBody = EMailBody & "Provider Name: " & ProviderName & "<br />"EMailBody = EMailBody & "Provider Type: " & ProviderType & "<br />"EMailBody = EMailBody & "Address1: " & Address & "<br />"EMailBody = EMailBody & "Address2: " & Address2 & "<br />"EMailBody = EMailBody & "City: " & City & "<br />"EMailBody = EMailBody & "State: " & State & "<br />"EMailBody = EMailBody & "Zip Code: " & Zipcode & "<br />"EMailBody = EMailBody & "Office Phone: " & OfficePhone & "<br />"EMailBody = EMailBody & "----------------------------------------------" & "<br />"EMailBody = EMailBody & " " & "</p>"EMailBody = EMailBody & "-------Contact Information--------" & "</p>"EMailBody = EMailBody & "Name: " & YourName & "<br />"EMailBody = EMailBody & "Address1: " & Address02 & "<br />"EMailBody = EMailBody & "Address2: " & Address22 & "<br />"EMailBody = EMailBody & "City: " & City2 & "<br />"EMailBody = EMailBody & "State: " & State2 & "<br />"EMailBody = EMailBody & "Zip Code: " & Zipcode2 & "<br />"EMailBody = EMailBody & "Phone Number: " & Telephone & "<br />"EMailBody = EMailBody & "E-Mail: " & Email & "<br />"EMailBody = EMailBody & "Are you a current member: " & Member & "<br />"EMailBody = EMailBody & "----------------------------------------------" & "<br />"EMailBody = EMailBody & " " & "</p>"EMailBody = EMailBody & "<p>Lead from" & "<br />"EMailBody = EMailBody & "</body>"EMailBody = EMailBody & "</html>"' correct' apply the settings to the messageWith iMsgSet .Configuration = iConf.To = "#".From = Email.Subject = MailSubj.HTMLBody = EMailBody'.AddAttachment "C:\activity.pdf".SendEnd With' cleanup of variablesSet iMsg = NothingSet iConf = NothingSet Flds = Nothing' if not cdoEmail.Send then' MailMsg = "<font color=""red"">EMail Notification FAILED!<p>Please go <b>back and Submit the form again.<p>Err=""</font>"' else' MailMsg = "EMail Notification successful."' end if%>\[/code\]
 
Back
Top