[ sheff @ 18.02.2010. 08:03 ] @
Kontakt forma mi stalno izbacuje gresku a nikako da nadjem u cemu je greska? Ne mislim da je neka teskoca, rijec je o sitnici koju ne vidim iz nekog cudnog razloga... valjda covjeku nekad mozak zablokira... Valjda ima neko ko zna ovaj stari ASP? Mislim da je problem samo u ovom malom dijelu na dnu kontakt.asp koji se bavi sa CDOSYSom... kontakt.asp datoteka: Code: <% 'The hidden variable called "mail_send" must be set to "y" for the mail to send IF Request.Form("mail_send") = "y" THEN '******************************************************* 'Get values from hidden fields for sending the mail '******************************************************* form_from = Request.Form("mail_from") 'who is the mail from, e.g. [email protected] form_to = Request.Form("mail_to") 'who is the mail to, e.g. [email protected] form_cc = Request.Form("") 'leave blank if not needed! who is the carbon copy to be sent to, e.g. [email protected] form_bcc = Request.Form("") 'leave blank if not needed! who is the blind carbon copy to be sent to, e.g. [email protected] form_subject = Request.Form("mail_subject") 'text to appear in subject line of the e-mail form_importance = Request.Form("mail_importance") 'importance of the e-mail. Must be a number 0, 1 or 2. 2 = High, 1 = Normal, 0 = Low form_redirect = Request.Form("mail_redirect") 'page to redirect to after sending e-mail, e.g. http://yoursite.com/thankyou.htm '******************************************************* 'If values are still the defaults, tell the user and stop the script '******************************************************* IF form_from = "[email protected]" THEN errorno = errorno + 1 errortext = errortext & "<b>" & errorno & ".</b> Default setting for the from address has not been changed in the hidden field<br>" END IF IF form_to = "[email protected]" THEN errorno = errorno + 1 errortext = errortext & "<b>" & errorno & ".</b> Default setting for the to address has not been changed in the hidden field<br>" END IF IF form_subject = "Greetings from Ireland!!" THEN errorno = errorno + 1 errortext = errortext & "<b>" & errorno & ".</b> Default setting for the mail subject has not been changed in the hidden field<br>" END IF IF errorno > 0 THEN Response.Write("<b>ERROR:</b> You have not changed some of the default settings in the sample html form. You need to fix the errors below before the script will run correctly. Once all errors are fixed, the script will run as it is supposed to.<br><br>") Response.Write(errortext) Response.Write("<br>Script ended. No mail has been sent.") Response.End END IF '******************************************************* 'If values are empty, put in some defaults '******************************************************* IF form_from = "" THEN form_from = "[email protected]>" IF form_to = "" THEN form_to = "[email protected]" IF form_cc = "" THEN form_cc = "" IF form_bcc = "" THEN form_bcc = "" IF form_subject = "" THEN form_subject = "Poruka sa web stranice www.domena.com" IF form_importance = "" THEN form_importance = 1 IF form_redirect = "" THEN form_redirect = "" '******************************************************* 'Get all form elements and structure the e-mail '******************************************************* FOR x = 1 TO Request.Form.Count IF Request.Form.Key(x) = "mail_from" OR Request.Form.Key(x) = "mail_to" OR Request.Form.Key(x) = "mail_cc" OR Request.Form.Key(x) = "mail_bcc" OR Request.Form.Key(x) = "mail_subject" OR Request.Form.Key(x) = "mail_importance" OR Request.Form.Key(x) = "mail_redirect" OR Request.Form.Key(x) = "mail_send" OR Request.Form.Key(x) = "Submit" THEN form_variables = form_variables ELSE form_variables = form_variables & Request.Form.Key(x) & ": " & vbcrlf & Request.Form.Item(x) & vbcrlf & vbcrlf END IF NEXT DIM body_text body_text = vbcrlf & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf body_text = body_text & form_subject & vbcrlf body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf & vbcrlf body_text = body_text & form_variables body_text = body_text & "Sent from: " & vbcrlf & Request.ServerVariables("HTTP_REFERER") & vbcrlf & vbcrlf body_text = body_text & "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & vbcrlf body_text = body_text & "Poruka sa moje web strane" & vbcrlf body_text = body_text & "http://www.domena.com" & vbcrlf '******************************************************* 'Get values from hidden fields for sending the mail '******************************************************* Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort = 2 Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/c...guration/smtpconnectiontimeout" Const smtpSrvPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const smtpConnTimeout= "http://schemas.microsoft.com/c...guration/smtpconnectiontimeout" Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername" Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword" CONST sendUrl = "http://schemas.microsoft.com/cdo/configuration/sendusing" CONST smtpUrl = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Dim objConfig Dim objMessage Dim Fields Set objConfig=Server.CreateObject("CDO.Configuration") objConfig.Fields.Item(sendUrl)= 2 ' cdoSendUsingPort objConfig.Fields.Item(smtpUrl)= "mail.domena.com" objConfig.Fields.Item(smtpConnTimeout)= 10 objConfig.Fields.Item(smtpSrvPort)= 25 objConfig.Fields.Item(cdoSMTPAuthenticate)= cdoBasic objConfig.Fields.Item(cdoSendUserName )= "[email protected]" objConfig.Fields.Item(cdoSendPassword )= "password" objConfig.Fields.Update ' Create and send the mail Set objMessage=Server.CreateObject("CDO.Message") ' Use the config object created above Set objMessage.Configuration=objConfig 'objMessage.BodyFormat = 1 'objMessage.MailFormat = 1 objMessage.From = form_from objMessage.To = form_to objMessage.CC = form_cc objMessage.BCC = form_bcc objMessage.Subject = form_subject 'objMessage.Importance = form_importance objMessage.TextBody = body_text objMessage.Send 'This line actually sends the e-mail SET objMessage= NOTHING Set Fields = Nothing Set objConfig = Nothing '******************************************************* 'Redirect to thank you page or write thank you '******************************************************* IF form_redirect = "" THEN Response.Write("Poruka je poslana! Hvala sto ste nas kontaktirali.") ELSE Response.Redirect(form_redirect) END IF '******************************************************* 'If form was submitted then show what is below "END IF" '******************************************************* END IF '******************************************************* 'There is a sample Feedback Form below to start you off. 'That's it. Hope you benefit from it. Happy Mailing! '******************************************************* %> kontakt.html datoteka: Code: <form name="feedbackform" method="post" action="kontakt.asp"> <table width="400" border="0" cellspacing="0" cellpadding="5"> <tr> <td valign="top">Message:</td> <td><textarea name="Message" cols="24" rows="8" id="Message"></textarea></td> </tr> <tr> <td width="120" valign="top">Name:</td> <td width="280"><input name="Name" type="text" id="Name" size="24"></td> </tr> <tr> <td width="120" valign="top">Address:</td> <td width="280"><textarea name="Address" cols="24" rows="5" id="Address"></textarea></td> </tr> <tr> <td width="120" valign="top">Phone:</td> <td width="280"><input name="Phone" type="text" id="Phone" size="24"></td> </tr> <tr> <td width="120" valign="top">Fax:</td> <td width="280"><input name="Fax" type="text" id="Fax" size="24"></td> </tr> <tr> <td width="120" valign="top">E-Mail:</td> <td width="280"><input name="E-Mail" type="text" id="E-Mail" size="24"></td> </tr> <tr> <td width="120" valign="top">Web Site:</td> <td width="280"><input name="Web Site" type="text" id="Web Site" size="24"></td> </tr> <tr> <td width="120" height="50"> <input name="mail_from" type="hidden" id="mail_from" value="[email protected]"> <input name="mail_to" type="hidden" id="mail_to" value="[email protected]"> <input name="mail_cc" type="hidden" id="mail_cc"> <input name="mail_bcc" type="hidden" id="mail_bcc"> <input name="mail_subject" type="hidden" id="mail_subject" value="Poruka sa web stranice www.domena.com"> <input name="mail_importance" type="hidden" id="mail_importance" value="2"> <input name="mail_redirect" type="hidden" id="mail_redirect"> <input name="mail_send" type="hidden" id="mail_send" value="y"></td> <td width="280" height="50"><input type="submit" name="Submit" value="Send"></td> </tr> <tr> <td width="120"> </td> <td width="280"> </td> </tr> </table> </form> [Ovu poruku je menjao sheff dana 18.02.2010. u 16:22 GMT+1] [Ovu poruku je menjao sheff dana 18.02.2010. u 18:25 GMT+1] [Ovu poruku je menjao sheff dana 18.02.2010. u 22:31 GMT+1] |