lilliancotton
New Member
I recently got helped to fix my ASP EMAIL script but now I get this compiling error when trying to send email from the CONTACT FORM .. The script is below the ERROR MESSAGEServer Error in '/' Application.Compilation ErrorDescription: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30807: 'Let' and 'Set' assignment statements are no longer supported.Source Error:Line 10: if Request("Send") <> "" Then Line 11:
Line 12: Set objMail = Server.CreateObject("Persits.MailSender") Line 13:
Line 14: objMail.Host = strHost Source File: E:\HostingSpaces\dma\myuniversalcare.com\wwwroot\contact-us\Default.aspx Line: 12 Here is the script:\[code\]<% Session.CodePage = 65001 Dim strHost, objMail, strToAddress, txtMsg ' Change this to your own SMTP server strHost = "localhost" if Request("Send") <> "" Then Set objMail = Server.CreateObject("Persits.MailSender") objMail.Host = strHost objMail.From = "[email protected]" ' From address objMail.FromName = "AspEmail Live Demo" ' optional strToAddress = Trim(Request("txtTo")) ' To prevent header injection attack strToAddress = Replace( strToAddress, " ", "" ) strToAddress = Replace( strToAddress, chr(13), "" ) strToAddress = Replace( strToAddress, chr(10), "" ) ' To address, 2nd argument omitted. objMail.AddAddress strToAddress ' Message subject objMail.Subject = objMail.EncodeHeader( Request("txtSubject"), "UTF-8" ) ' Enable Unicode objMail.ContentTransferEncoding = "Quoted-Printable" objMail.CharSet = "UTF-8" ' Message body objMail.Body = Request("txtBody") ' Include a disclaimer objMail.Body = objMail.Body & chr(13) & chr(10) & chr(13) & chr(10) & "-----------------------------------" & chr(13) & chr(10) & chr(13) & chr(10) & "This message was generated by the AspEmail live demo on-line application. Persits Software, Inc. is not responsible for its content." On Error Resume Next objMail.Send ' Send message If Err = 0 then txtMsg = "<font color=green>Success! Message sent to " & strToAddress + ".</font>" Else txtMsg = "<font color=red>Error occurred: " + err.Description + "</font>" End If End If %> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8"> <TITLE>AspEmail Live Demo: Unicode-enabled Message Sending</TITLE> </HEAD> <BODY style="font-family: arial narrow; font-size: 10pt"> <h2>AspEmail Live Demo: Unicode-enabled Message Sending</h2> <P> <FORM METHOD="POST" ACTION="demo_simple.asp"> <TABLE CELLSPACING=2 CELLPADDING=2 BGCOLOR="#E0E0E0" style="border: 1pt black solid; border-collapse: collapse"> <TR> <TD>To:</TD> <TD><INPUT TYPE="TEXT" size="40" NAME="txtTo" VALUE="http://stackoverflow.com/questions/12081610/<% = Server.HtmlEncode(Request("txtTo")) %>"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE="TEXT" size="40" NAME="txtSubject" VALUE="http://stackoverflow.com/questions/12081610/<% = Server.HtmlEncode(Request("txtSubject")) %>"></TD> </TR> <TR> <TD valign="top">Body:</TD> <TD><TEXTAREA NAME="txtBody" Rows="10" Cols="40"><% = Server.HtmlEncode(Request("txtBody")) %></TEXTAREA></TD> </TR> <TR> <TD COLSPAN=2><INPUT TYPE="SUBMIT" NAME="Send" VALUE="http://stackoverflow.com/questions/12081610/Send Message"></TD> </TR> </TABLE> <P> <% = txtMsg %> </FORM> </BODY> </HTML> \[/code\]
Line 12: Set objMail = Server.CreateObject("Persits.MailSender") Line 13:
Line 14: objMail.Host = strHost Source File: E:\HostingSpaces\dma\myuniversalcare.com\wwwroot\contact-us\Default.aspx Line: 12 Here is the script:\[code\]<% Session.CodePage = 65001 Dim strHost, objMail, strToAddress, txtMsg ' Change this to your own SMTP server strHost = "localhost" if Request("Send") <> "" Then Set objMail = Server.CreateObject("Persits.MailSender") objMail.Host = strHost objMail.From = "[email protected]" ' From address objMail.FromName = "AspEmail Live Demo" ' optional strToAddress = Trim(Request("txtTo")) ' To prevent header injection attack strToAddress = Replace( strToAddress, " ", "" ) strToAddress = Replace( strToAddress, chr(13), "" ) strToAddress = Replace( strToAddress, chr(10), "" ) ' To address, 2nd argument omitted. objMail.AddAddress strToAddress ' Message subject objMail.Subject = objMail.EncodeHeader( Request("txtSubject"), "UTF-8" ) ' Enable Unicode objMail.ContentTransferEncoding = "Quoted-Printable" objMail.CharSet = "UTF-8" ' Message body objMail.Body = Request("txtBody") ' Include a disclaimer objMail.Body = objMail.Body & chr(13) & chr(10) & chr(13) & chr(10) & "-----------------------------------" & chr(13) & chr(10) & chr(13) & chr(10) & "This message was generated by the AspEmail live demo on-line application. Persits Software, Inc. is not responsible for its content." On Error Resume Next objMail.Send ' Send message If Err = 0 then txtMsg = "<font color=green>Success! Message sent to " & strToAddress + ".</font>" Else txtMsg = "<font color=red>Error occurred: " + err.Description + "</font>" End If End If %> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8"> <TITLE>AspEmail Live Demo: Unicode-enabled Message Sending</TITLE> </HEAD> <BODY style="font-family: arial narrow; font-size: 10pt"> <h2>AspEmail Live Demo: Unicode-enabled Message Sending</h2> <P> <FORM METHOD="POST" ACTION="demo_simple.asp"> <TABLE CELLSPACING=2 CELLPADDING=2 BGCOLOR="#E0E0E0" style="border: 1pt black solid; border-collapse: collapse"> <TR> <TD>To:</TD> <TD><INPUT TYPE="TEXT" size="40" NAME="txtTo" VALUE="http://stackoverflow.com/questions/12081610/<% = Server.HtmlEncode(Request("txtTo")) %>"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE="TEXT" size="40" NAME="txtSubject" VALUE="http://stackoverflow.com/questions/12081610/<% = Server.HtmlEncode(Request("txtSubject")) %>"></TD> </TR> <TR> <TD valign="top">Body:</TD> <TD><TEXTAREA NAME="txtBody" Rows="10" Cols="40"><% = Server.HtmlEncode(Request("txtBody")) %></TEXTAREA></TD> </TR> <TR> <TD COLSPAN=2><INPUT TYPE="SUBMIT" NAME="Send" VALUE="http://stackoverflow.com/questions/12081610/Send Message"></TD> </TR> </TABLE> <P> <% = txtMsg %> </FORM> </BODY> </HTML> \[/code\]