asp classic - Submit form is not working in asp -
while sending email @ website facing issue when submitting form. form can found @ following location.
http://www.someone.com/medicalights/contact.htm
i using smtpsvg.mailer object send email. object supported on server , if yes, can use localhost in remote host property. i've tried cdonts.new | mailcdo.message these not working fine. please ask support department of hosting company issue.
the following code using send email.
set mailer = server.createobject("smtpsvg.mailer")
mailer.remotehost = "localhost" mailer.returnreceipt = false mailer.confirmread = false mailer.priority = 1 mailer.urgent = false mailer.timeout = 30 mailer.fromname = "someone.com" mailer.fromaddress = "info@someone.com" mailer.addrecipient "que33@gmail.com", "que33@gmail.com" mailer.subject = "contact request" mailer.bodytext = body sendmail = mailer.sendmail
i using same code website working perfect 1 not , both website's contact form sending email same address.
the link form doesn't work. see html of form, asp code reads submitted data. concur john's recommendation use cdosys code sending mail. problem. here function created cms use whenever page needs send email:
<% function email(s_from,s_reply_to,s_recipients,s_bcc,s_subject,s_msg,s_type,s_msg_error_add,s_remote_host) if (s_msg_error_add<>"") s_msg_error_add = "<hr>" & vbcrlf & s_msg_error_add if (s_remote_host="default") s_remote_host = application("s_mail_server") if (s_remote_host="") s_remote_host = "localhost" s_remote_host=lcase(s_remote_host) 's_recipients looks "scott <scott@domain.net>; sue <andy@domain.net>" etc s_from = replace(s_from,","," ",1,-1,1) s_from = replace(s_from," "," ",1,-1,1) s_from = replace(s_from,"[","<",1,-1,1) s_from = replace(s_from,"]",">",1,-1,1) if (s_reply_to<>"") s_reply_to = replace(s_reply_to,","," ",1,-1,1) s_reply_to = replace(s_reply_to," "," ",1,-1,1) s_reply_to = replace(s_reply_to,"[","<",1,-1,1) s_reply_to = replace(s_reply_to,"]",">",1,-1,1) end if s_recipients = replace(s_recipients,",",";",1,-1,1) s_recipients = replace(s_recipients," "," ",1,-1,1) s_recipients = replace(s_recipients,"[","<",1,-1,1) s_recipients = replace(s_recipients,"]",">",1,-1,1) if (s_bcc<>"") s_bcc = replace(s_bcc,","," ",1,-1,1) s_bcc = replace(s_bcc," "," ",1,-1,1) s_bcc = replace(s_bcc,"[","<",1,-1,1) s_bcc = replace(s_bcc,"]",">",1,-1,1) end if err.clear dim mailerconfig dim mailer dim strret dim sch strret = "" sch = "http://schemas.microsoft.com/cdo/configuration/" set mailerconfig = createobject("cdo.configuration") set mailer = createobject("cdo.message") mailerconfig.fields '.item(sch & "sendusing") = 2 'send using port - if err "sendusingmethod" '.item(sch & "sendusingmethod") = 2 'send using port - if err "sendusingmethod" .item(sch & "smtpconnectiontimeout") = 900 '.item(sch & "smtpauthenticate") = 1 'use basic (clear-text) authentication .item(sch & "smtpserver") = s_remote_host '.item(sch & "smtpserverport") = 25 '.item(sch & "sendusername") = smauthuser '.item(sch & "sendpassword") = smauthpass .update end mailer.configuration = mailerconfig 'mailer.fields(cdoimportance) = 1 'mailer.fields("urn:schemas:mailheader:x-msmail-priority") = 1 'mailer.fields("urn:schemas:mailheader:x-mailer") = "" 'mailer.fields.update '-- set mail properties 'on error resume next mailer.from = s_from mailer.to = s_recipients if (s_reply_to<>"" , s_reply_to<>"na") mailer.replyto = s_reply_to b_redirect=false if (err.number<>0 , err.number<>13) session("msg") = "error in i_fn_email_cdo.asp line 72, error: " & err.number & "<br>" & err.description if (b_redirect) response.redirect ("error_report.asp?send_mail=yes") end if if (s_bcc<>"" , s_bcc<>"na" , s_bcc<>"n/a") mailer.bcc = s_bcc if (err.number<>0 , err.number<>13) session("msg") = "error in i_fn_email_cdo.asp line 79, error: " & err.number & "<br>" & err.description if (b_redirect) response.redirect ("error_report.asp?send_mail=yes") end if mailer.subject = s_subject if (err.number<>0 , err.number<>13) session("msg") = "error in i_fn_email_cdo.asp line 86, error: " & err.number & "<br>" & err.description if (b_redirect) response.redirect ("error_report.asp?send_mail=yes") end if if (s_type="html") mailer.autogeneratetextbody = true s_msg = replace(s_msg,vbcrlf,"<br>",1,-1,1) else mailer.autogeneratetextbody = false end if if (err.number<>0 , err.number<>13) session("msg") = "error in i_fn_email_cdo.asp line 103, error: " & err.number & "<br>" & err.description if (b_redirect) response.redirect ("error_report.asp?send_mail=yes") end if mailer.mimeformatted = false if (err.number<>0 , err.number<>13) session("msg") = "error in i_fn_email_cdo.asp line 110, error: " & err.number & "<br>" & err.description if (b_redirect) response.redirect ("error_report.asp?send_mail=yes") end if if (s_type = "text") mailer.textbody = fn_dirty(s_msg) else 's_msg_html = replace(s_msg,vbcrlf,"<br>",1,-1,1) s_msg_html = s_msg mailer.htmlbody = fn_dirty(s_msg_html) end if if (err.number<>0 , err.number<>13) session("msg") = "error in i_fn_email_cdo.asp line 123, error: " & err.number & "<br>" & err.description if (b_redirect) response.redirect ("error_report.asp?send_mail=yes") end if '-- fire off email message mailer.send if (err.number<>0 , err.number<>13) select case err.number case -2147220973 strret = " failure send report message - server not found" & vbcrlf & " error: " & err.number & " - " & err.description case -2147220975 strret = " failure send report message - server authentication failed" & vbcrlf & " error: " & err.number & " - " & err.description case else strret = " failure send report message - error: " & err.number & " - " & err.description end select msg = "<br>error in i_fn_email_cdo.asp: " & strret & "<br><br>" msg = msg & "remote host = " & s_remote_host & "<br>" s_from = replace(s_from,"<","[",1,-1,1) s_from = replace(s_from,">","]",1,-1,1) s_reply_to = replace(s_reply_to,"<","]",1,-1,1) s_reply_to = replace(s_reply_to,">","[",1,-1,1) s_recipients = replace(s_recipients,"<","[",1,-1,1) s_recipients = replace(s_recipients,">","]",1,-1,1) s_bcc = replace(s_bcc,"<","[",1,-1,1) s_bcc = replace(s_bcc,">","]",1,-1,1) msg = msg & "from = " & s_from & "<br>" msg = msg & "to = " & s_recipients & "<br>" msg = msg & "subject = " & s_subject & "<br>" msg = msg & "recipients = " & s_recipients & "<br><br>" if (s_type = "text") msg = msg & s_msg else msg = msg & s_msg_html end if msg = msg & "<br>" msg = msg & s_msg_error_add session("msg") = msg set mailer = nothing set mailerconfig = nothing if (b_redirect) response.redirect ("error_report.asp?send_mail=yes") end if set mailer = nothing set mailerconfig = nothing email = true end function function fn_dirty(fixwhat) if (isnull(fixwhat) or fixwhat="") fixwhat="" else fixwhat=trim(fixwhat) fixwhat=replace(fixwhat,"<ahref","<a href",1,-1,1) fixwhat=replace(fixwhat,"<spanclass","<span class",1,-1,1) fixwhat=replace(fixwhat," "," ",1,-1,1) fixwhat=replace(fixwhat,"’","'",1,-1,1) fixwhat=replace(fixwhat,"'","'",1,-1,1) fixwhat=replace(fixwhat,"%27","'",1,-1,1) fixwhat=replace(fixwhat,"'","'",1,-1,1) fixwhat=replace(fixwhat,"’","'",1,-1,1) fixwhat=replace(fixwhat,"/","/",1,-1,1) fixwhat=replace(fixwhat,"''''","'''",1,-1,1) fixwhat=replace(fixwhat,""",chr(34),1,-1,1) fixwhat=replace(fixwhat,"%22",chr(34),1,-1,1) fixwhat=replace(fixwhat,chr(13) & chr(10),"",1,-1,1) fixwhat=replace(fixwhat,"title=","alt=",1,-1,1) fixwhat=replace(fixwhat,"src=" & chr(34) & chr(32),"",1,-1,1) fixwhat=replace(fixwhat,"src=" & chr(34) & "/images","src=" & chr(34) & "images",1,-1,1) fixwhat=replace(fixwhat,"background=" & chr(34) & chr(32),"background=" & chr(34) & chr(34) & chr(32),1,-1,1) fixwhat=replace(fixwhat,"x=" & chr(34) & chr(32)," ",1,-1,1) fixwhat=replace(fixwhat,"&","&",1,-1,1) fixwhat=replace(fixwhat,"amp;","&",1,-1,1) fixwhat=replace(fixwhat,"&","&",1,-1,1) fixwhat=replace(fixwhat,"&&","&",1,-1,1) fixwhat=replace(fixwhat,"&&","&",1,-1,1) fixwhat=replace(fixwhat,"<","<",1,-1,1) fixwhat=replace(fixwhat,">",">",1,-1,1) fixwhat=replace(fixwhat,"//<![cdata[","",1,-1,1) fixwhat=replace(fixwhat,"//]]","",1,-1,1) fixwhat=replace(fixwhat,"<table","<table",1,-1,1) fixwhat=replace(fixwhat,"<tbody>","<tbody>",1,-1,1) fixwhat=replace(fixwhat,"<tr","<tr",1,-1,1) fixwhat=replace(fixwhat,"<td","<td",1,-1,1) fixwhat=replace(fixwhat,"</tr>","</tr>",1,-1,1) fixwhat=replace(fixwhat,"</td>","</td>",1,-1,1) fixwhat=replace(fixwhat,"<html><br>","<html>",1,-1,1) fixwhat=replace(fixwhat,"<head><br>","<head>",1,-1,1) fixwhat=replace(fixwhat,"<body><br>","<body>",1,-1,1) fixwhat=replace(fixwhat,"<br><tbody>","<tbody>",1,-1,1) fixwhat=replace(fixwhat,"<tbody><br>","<tbody>",1,-1,1) fixwhat=replace(fixwhat,"<br><tr>","<tr>",1,-1,1) fixwhat=replace(fixwhat,"<tr><br>","<tr>",1,-1,1) fixwhat=replace(fixwhat,"<br><td","<td",1,-1,1) fixwhat=replace(fixwhat,"<br></html>","</html>",1,-1,1) end if fn_dirty=fixwhat end function %>
Comments
Post a Comment