Solved

Problem sending form content with CDOSYS

Posted on 2014-04-02
13
357 Views
Last Modified: 2014-04-05
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
0
Comment
Question by:PhilR714
  • 5
  • 4
  • 3
13 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39973655
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.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39973662
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.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39973701
Also, please post the code that godaddy shows working.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39974177
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

0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39974185
That makes sense.  Dave's line 22 is PhilR714's line 29.    cdoSendUsingPort (2) it is.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39974216
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
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:PhilR714
ID: 39980343
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

0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39980363
The problem was that you were not setting the configuration.  This works on my Godaddy Windows account.  I have commented out the form variables so I could test the page by itself.
<%@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")
MyRequest = "request"
MyFirstname = "firstname"
MyLastname = "lastname"
MyEmail = "you@yoursite.com"
'
' 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

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

Set MyMail = CreateObject("CDO.Message")
' Use the config object created above
Set MyMail.Configuration=objConfig
MyMail.From = MyEmail
MyMail.To = "pastorsal@godisable.org"
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

0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39980374
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

0
 

Author Closing Comment

by:PhilR714
ID: 39980411
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
0
 

Author Comment

by:PhilR714
ID: 39980419
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
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39980428
Scott, the Flash is not in the email but in the response page.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now