Link to home
Start Free TrialLog in
Avatar of Phil Rine
Phil Rine

asked on

Problem sending form content with CDOSYS

I have 2 forms that were created on a web site in 2007.  The forms have always worked in the past but for some reason they are not now.  When the form is filled in and the user clicks send, the .asp page called that sends the form does not display and the generic HTTP 500 error shows instead.  I contacted Godaddy to see if they could tell me if something changed on their side making my code not compatible in some way but they said nothing has changed.  They uploaded one of their own CDOSYS forms that they use for testing and it worked fine.  I have looked the code over and cannot see anything different that should be done.  Again, this code has worked on this site in the past without issue.  If someone could look and let me know what they think it would be greatly appreciated.
The site is www.godisable.org.  There is a Prayer Request button on the top right of the home page that calls one of the forms (http://www.godisable.org/prayerrequestform.asp).  
There is also another form located here http://www.godisable.org/freegiftform.asp that produces the same results.
The person I spoke to at GoDaddy admitted that he is not well versed in this and was consulting with someone else.  He suggested to rebuild the form pages but I don't see anything that I could do different.
Thank you in advance,
Phil
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

The asp code is done serverside so there is no way to see your code on a public server.  Please post your code here and make sure to take out passwords and usernames.

Also, you need to use cdo and not cdosys.
From the error, you are using cdo

CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

/cdosys_pform.asp, line 29

Open in new window


Without seeing your complete code, it is hard to say, but you have 3 choices http://msdn.microsoft.com/en-us/library/ms873037(v=exchg.65).aspx
cdoSendUsingPickup (1)
cdoSendUsingPort (2)
cdoSendUsingExchange (3)

More than likely you are using 2 (port) and try 1(pickup)  unless you are using exchange server.
Also, please post the code that godaddy shows working.
This code I got from a Godaddy article works.  I just double checked.  You need to put valid email addresses in there.
<%@ LANGUAGE = VBScript %>
<%  Option Explicit		%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>CDO-Email</title>
</head>
<body>
<h1>CDO-Email</h1>
<p>Godaddy demo code.</p>
<p>Tested and working on 2012-03-23 / 2013-08-18 / 2014-04-02</p>
<%
Dim sendUrl, smtpUrl, objConfig, objMail

sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"
objConfig.Fields.Update

' Create and send the mail
Set objMail=CreateObject("CDO.Message")
' Use the config object created above
Set objMail.Configuration=objConfig
objMail.From="you@yoursite.com"
objMail.ReplyTo="you@yoursite.com"
objMail.To="them@theirsite.com"
objMail.Subject="This are the subject"
objMail.TextBody="And this are the body."
objMail.Send
%> 
</body>
</html>

Open in new window

That makes sense.  Dave's line 22 is PhilR714's line 29.    cdoSendUsingPort (2) it is.
Here are a number of variations: http://www.paulsadowski.com/wsh/cdo.htm  The W3Schools page also has some more: http://www.w3schools.com/asp/asp_send_email.asp
Avatar of Phil Rine
Phil Rine

ASKER

He is the code I am currently using and that was working for years:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' Dim of variables
Dim MyMail
Dim MyBody
Dim MyRequest
Dim MyFirstname
Dim MyLastname
Dim MyEmail
'
' Get values from form
MyRequest = Request.Form("request")
MyFirstname = Request.Form("firstname")
MyLastname = Request.Form("lastname")
MyEmail = Request.Form("email")
'
' Body contents of the email
MyBody = "First Name: "& MyFirstname & vbcrlf
MyBody = MyBody & "Last Name: "& MyLastname & vbcrlf
MyBody = MyBody & "E-Mail: "& MyEmail & vbcrlf & vbcrlf
MyBody = MyBody & "Prayer Request: "& vbcrlf
MyBody = MyBody & MyRequest

Set MyMail = CreateObject("CDO.Message")
MyMail.From = MyEmail
MyMail.To = "somebody@domain.com"
MyMail.Subject = "Prayer Request"
MyMail.TextBody = MyBody
MyMail.Send
Set MyMail= nothing
'Response.Write("Your e-mail has been sent")		
%>
<html>
<head>
<title>Bethpage Assembly of God :: Prayer Request Confirmation</title>
<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.godisable.org/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
-->
</style>
<style type="text/css">
<!--
body {
	background-image:  url(images/lgrey091.gif);
}
-->
</style>
</head>

<body>
<table width="801" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: 3px solid black";>
  <!--DWLayoutTable-->
  <tr> 
    <td height="225" colspan="4" valign="top"> <p>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="795" height="225">
          <param name="movie" value="headergallery3.swf">
          <param name=quality value=high>
          <embed src="headergallery3.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="795" height="225"></embed> 
        </object>
      </p></td>
  </tr>
  <tr> 
    <td width="165" height="437" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/lgrey008.jpg" bgcolor="#EBF0FC">
        <!--DWLayoutTable-->
        <tr> 
          <td width="165" height="22" valign="top">&nbsp; </td>
        </tr>
        <tr> 
          <td height="415">&nbsp;</td>
        </tr>
      </table></td>
    <td width="14">&nbsp;</td>
    <td width="610" valign="top"><H2 align="center">Prayer Request Has Been Sent.<br>
        You will be redirected back to our<br>
        home page in 10 seconds.<br>
        If you are not, please click <a href="default.htm">here</a>.</h2>
      <% If strErr <> "" Then %> <h3><FONT COLOR="#FF0000">Error occurred: <I> 
        <% = strErr %>
        </I></FONT></h3>
      <% End If %> <% If bSuccess Then %> <h3><FONT COLOR="#00A000">Your Prayer Request 
        has been sent. Thank you.</FONT></h3>
      <% End If %> &nbsp;</td>
    <td width="6">&nbsp;</td>
  </tr>
  <tr> 
    <td height="0"></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
</table>
<!-- #BeginLibraryItem "/Library/copyright.lbi" -->
<hr>
<p><font color="#000000" style="background-color: #dddddd">For general church questions 
  and comments please e-mail us at <a href="mailto:%20info@godisable.org">Bethpage Assembly of God</a><br>
  Copyright &copy; 2010 Bethpage Assembly of God, all rights reserved.<br>
  Website designed and maintained by </font><font color="#CCCCCC" style="background-color: #dddddd;"><a href="http://www.microfocuscomputer.com" target="_blank">Microfocus 
  Computer Services, Inc.</a></font></p><!-- #EndLibraryItem --></body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For your email, I would suggest changing your flash object to a simple image.  Does that even work?

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="795" height="225">
          <param name="movie" value="headergallery3.swf">
          <param name=quality value=high>
          <embed src="headergallery3.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="795" height="225"></embed> 
        </object>

Open in new window

Thank you Dave!  It works perfectly now.  The confusing thing to me is that it worked in the past.  I don't know exactly when it stopped but I am glad it's back up and running.
Phil
Scott,
Thanks for editing the code.  I should know better than that.  Would you do the same to the code that Dave posted that I marked as the answer?
Phil
Scott, the Flash is not in the email but in the response page.