Solved

Problem sending form content with CDOSYS

Posted on 2014-04-02
13
361 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 83

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 83

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
 

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 83

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 83

Expert Comment

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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

773 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