0

I am using a server side script using CDO on Network solution that is now failing with a '500 server error' Have they changed their Windows servers?

This code works fine on some other domains hosted by Network solutions. I tried changing to localhost and the server port to 25 with no luck.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<% 
Dim cdoConfig, cdoMessage, sch, nProfileID, sFName, sLName, sEmail, sBCC, sFromEmail,    sMessage, Optin

nProfileID = Request.Form("profileID")
sFName = Request.Form("fname")
sLName = Request.Form("lname")
sFromEmail = Request.Form("email")
sMessage = Request.Form("message")
Optin = Request.Form("optin")


'sAction = "email_form_work.asp?profileID=" & nProfileID
sEmail = "m.hill@secretagency.com" 'generic email account *** change to info@bglawde.com
sBCC = "hillcreative@comcast.net"


sch = "http://schemas.microsoft.com/cdo/configuration/" 
Set cdoConfig = CreateObject("CDO.Configuration") 

With cdoConfig.Fields 
    'Set CDO Port 
    .Item(sch & "sendusing") = 1
    'Set mailserver name either IP address, mail.yoursite.com or localhost 
    .Item(sch & "smtpserver") = "smtp.secretagency.com"
    'Set SMTP port which is 25 by default 
    .Item(sch & "smtpserverport") = 2525
    'Set number of seconds before timeout 
    .Item(sch & "smtpconnectiontimeout") = 60


    .update 
End With 

Set cdoMessage = CreateObject("CDO.Message") 

With cdoMessage 
    Set .Configuration = cdoConfig 
    .From = sFromEmail
    .To = sEmail
    .CC = ""
    'use this to send a blind copy 
    .BCC = sBCC
    .Subject = ""
    'Send the email in text format *comment out HTML
    .TextBody = sFName & " " & sLName & " has sent you the following message:" & vbCRLF & vbCRLF & sMessage & vbCRLF
    .Send 
End With
set cdoMessage = nothing
set cdoConfig = nothing


'************ Mail ends here ********************

%>
Calon
  • 4,174
  • 1
  • 19
  • 30
hillcreative
  • 133
  • 2
  • 11
  • I don't see any error detection or handling! Aside from CDO being obsolete - the problem could easily be configuration or permissions. Check the server's logs; put some error handling in your code, and troubleshoot from there. – FoggyDay Nov 08 '14 at 21:06
  • Still doesn't explain why it no longer works at network solutions. I understand your comment for best practices but... – hillcreative Nov 08 '14 at 21:11
  • F** best practices. Without error messages, you're ignorantly shooting in the dark. – FoggyDay Nov 08 '14 at 21:35
  • Perhaps some constructive help. Thanks for your time. – hillcreative Nov 09 '14 at 01:00
  • [try to see what the exact error message is](http://www.chestysoft.com/asp-error-messages.asp) – Flakes Nov 09 '14 at 05:58
  • [Another link to custom error pages](http://iislogs.com/steveschofield/2008/12/20/custom-errors-error-pages-500-100-asp-classic-asp-and-iis-7-0/) – Flakes Nov 09 '14 at 07:52
  • No access to remote server (Network Solutions) set browser for friendly error msg but none showing. Just generic 500 error. Here is the test CDO file URL: http://www.secretagency.com/testmail.asp PS. server is IIs 7.5 – hillcreative Nov 09 '14 at 15:12
  • @FoggyDay I know CDONTS is obsolete, I thought CDO, (or CDOSYS as some know it) was still the standard way to send emails with Classic ASP) – John Nov 09 '14 at 15:53
  • @hillcreative - If changing your server settings with IIS manager isn't an option you may still be able to enable detailed error messages with a web.config file. One of the answers to this question explains how http://stackoverflow.com/questions/2640526/detailed-500-error-message-asp-iis-7-5 – John Nov 09 '14 at 17:20
  • If at all possible, please modify your code to print error messages. You can use [on error resume next/response.write (err.Description)](http://powerasp.net/content/new/on-error-resume-next.asp) – FoggyDay Nov 09 '14 at 18:31

1 Answers1

0

Problem solved. Network solutions Windows Server will only work with CDO when employing Authentication: cdoSMTPAuthenticate, cdoSendUsername, cdoSendPassword must be defined.

hillcreative
  • 133
  • 2
  • 11
  • No authentication using CDO on Network Solutions and the CDO will fail! I don't know how to make it simpler for an approved answer... jeez... – hillcreative Nov 14 '14 at 03:55