Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

Form submission not working after changing website host

I am moving the hosting of a website from one server to another.
The website includes a form submitted by e-mail.
When "submitting" the form on the new hosting server the following error message occurs:-
    CDO.Message.1 error '80040220'
    The "SendUsing" configuration value is invalid.
    /confirm.asp, line 36
I do not know what the code was originally written in, but I am now using MS Expression Web.
The webpages are all.asp and the new server (1&1) has Frontpage Server Extensions enabled (although I don't know if that's relevant anymore, afer moving to Expression Web).
I've attached the relevant code. Can anybody help please?



Dim myName, myEmail, myContact, myTime, myOrder, myAddress, myPostcode
	myName=Request.Form("txtName")
	myEmail=Request.Form("txtEmail")
	myContact=Request.Form("txtContact")
	myTime=Request.Form("radTime")
	myOrder=Request.Form("txtOrder")
	myAddress=Request.Form("txtAddress")
	myPostcode=Request.Form("txtPostcode")
	
	Dim myMail, myText
	Set myMail = Server.CreateObject("CDO.Message")
 
	myMail.From = myEmail
	myMail.To = "[e-mail address here]"
	myMail.CC = myEmail
	myMail.BCC = "[e-mail address here]"
	myMail.Subject = "[e-mail subject here]"
		
	myText=myText & "Name: " & myName & vbCr & vbLf
	myText=myText & "Email: " & myEmail& vbCr & vbLf
	myText=myText & "Tel: " & myContact& vbCr & vbLf
	myText=myText & "Address: " & myAddress& vbCr & vbLf
	myText=myText & "Postcode: " & myPostcode& vbCr & vbLf
	myText=myText & "Time: " & myTime & vbCr & vbLf & vbCr & vbLf
	myText=myText & "Order: " & myOrder
	
	myMail.TextBody = myText
			
	'myMail.Fields.Update()
			
	myMail.Send 
	Set myMail = Nothing

Open in new window

0
socross
Asked:
socross
  • 6
  • 5
3 Solutions
 
bluV11tCommented:
Hi!
Could you post the code for confirm.asp where the error occurs?
0
 
socrossAuthor Commented:
This is the code for confirm.asp
<!-- #include file="site/top.asp" -->
<%
if Request.Form("cmdSend")<>"" then
	
	Dim myName, myEmail, myContact, myTime, myOrder, myAddress, myPostcode
	myName=Request.Form("txtName")
	myEmail=Request.Form("txtEmail")
	myContact=Request.Form("txtContact")
	myTime=Request.Form("radTime")
	myOrder=Request.Form("txtOrder")
	myAddress=Request.Form("txtAddress")
	myPostcode=Request.Form("txtPostcode")
	
	Dim myMail, myText
	Set myMail = Server.CreateObject("CDO.Message")
 
	myMail.From = myEmail
	'myMail.To = "tom@clickfire.co.uk"
	myMail.To = "mike.cross@socross.co.uk"
	myMail.CC = myEmail
	'myMail.BCC = "client@clickfire.biz"
	myMail.Subject = "Snack Attack Order from Website"
		
	myText=myText & "Name: " & myName & vbCr & vbLf
	myText=myText & "Email: " & myEmail& vbCr & vbLf
	myText=myText & "Tel: " & myContact& vbCr & vbLf
	myText=myText & "Address: " & myAddress& vbCr & vbLf
	myText=myText & "Postcode: " & myPostcode& vbCr & vbLf
	myText=myText & "Time: " & myTime & vbCr & vbLf & vbCr & vbLf
	myText=myText & "Order: " & myOrder
	
	myMail.TextBody = myText
			
	'myMail.Fields.Update()
			
	myMail.Send 
	Set myMail = Nothing
	
end if
%>
<%
if Request.Form("cmdSend")="" then
%>
<h1>Confirm your order...</h1>
 
<div class="sidebarText">
 
Please check the following details:<br>
<br>
<span style="font-weight: bold">Your name:</span> <%=Request.Form("txtName")%><br>
<br>
<span style="font-weight: bold">Email Address:</span> <%=Request.Form("txtEmail")%><br>
<br>
<span style="font-weight: bold">Contact Number:</span> <%=Request.Form("txtContact")%><br>
<br>
<span style="font-weight: bold">Address:</span> <%=Request.Form("txtAddress")%><br>
<br>
<span style="font-weight: bold">Postcode:</span> <%=Request.Form("txtPostcode")%><br>
<br>
<span style="font-weight: bold">Time:</span> <%=Request.Form("radTime")%><br>
<br>
<span style="font-weight: bold">Your order:</span><br><%=Request.Form("txtOrder")%><br>
<br><hr>
Please make sure you have specified the correct quantities and any specific requirements<br>
 
 
<form name="form1" method="post" action="--WEBBOT-SELF--">
   
   <!--webbot bot="SaveResults" S-Email-Format="TEXT/PRE" S-Email-Address="snack@ttack.biz" B-Email-Label-Fields="TRUE" B-Email-Subject-From-Field="TRUE" S-Email-Subject="Order from Snackattack Website" S-Date-Format="%d/%m/%Y" S-Time-Format="%H:%M" S-Builtin-Fields="Date Time" U-Confirmation-Url="confirm.asp" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan -->
   
   <input name="txtName" type="hidden" value="<%=Request.Form("txtName")%>">
   <input name="txtEmail" type="hidden" value="<%=Request.Form("txtEmail")%>">
   <input name="txtContact" type="hidden" value="<%=Request.Form("txtContact")%>">
   <input name="txtAddress" type="hidden" value="<%=Request.Form("txtAddress")%>">
   <input name="txtPostcode" type="hidden" value="<%=Request.Form("txtPostcode")%>">
   <input name="radTime" type="hidden" value="<%=Request.Form("radTime")%>">
   <input name="txtOrder" type="hidden" value="<%=Request.Form("txtOrder")%>">
   
    <input type="button" name="cmdBack" value="&lt;&lt; Back" onClick="javascript: history.go(-1)">
    <input type="submit" name="cmdSend" value="Send">
  </form>
 
</div>
<% else %>
<br>
<h2>Thankyou for your order. <br><br>
Your order has been emailed to snack attack and confirmation sent to <%=Request.Form("txtEmail")%><br></h2>
<br>
click <a href="default.asp">here</a> to return to the home page
 
<% end if %><!-- #include file="site/bottom.asp" -->

Open in new window

0
 
bluV11tCommented:
You probably need to configure it, don't know why stopped working after the move.



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/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       = _
	"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           = _
	"http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           = _
	"http://schemas.microsoft.com/cdo/configuration/sendpassword"
 
Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields
 
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
 
' Set config fields we care about (commented out the ones I usually don't use)
With Fields
	.Item(cdoSendUsingMethod)       = cdoSendUsingPort
	.Item(cdoSMTPServer)            = "your_smtp_server_name_here"
	.Item(cdoSMTPServerPort)        = 25
	'.Item(cdoSMTPConnectionTimeout) = 10
	'.Item(cdoSMTPAuthenticate)      = cdoBasic
	'.Item(cdoSendUserName)          = "username"
	'.Item(cdoSendPassword)          = "password"
 
	.Update
End With
 
Set myMail.Configuration = objConfig

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
socrossAuthor Commented:
So does the configuration code simply go at the top of the page (between lines 1 and 2 of the original confirm.asp) ?
0
 
bluV11tCommented:
I'd just put it on line 16.  
0
 
socrossAuthor Commented:
I'm afraid doing that just renders the whole confirm.asp page un-displayable by my browser (IE7).
I get the standard error message:  HTTP 500 Internal Server Error: "The website cannot display this page"

0
 
bluV11tCommented:
Hi!
To see the actual error message in IE do this:

Tools / Internet Options / Advanced. Uncheck the option "Show friendly HTTP error messages".

Then reload the page and post the error message back to me, Ok?
0
 
socrossAuthor Commented:
Here is the "unfriendly" error message:

Active Server Pages error 'ASP 0245'
Mixed usage of Code Page values
/site/top.asp, line 1
The @CODEPAGE value specified differs from that of the including file's CODEPAGE or the file's saved format.

I have also attached the code for /site/top.asp in case you need to see it.


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Option Explicit
%>
<!-- #include file="browserdetection.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Snack Attack</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="site/styles.css" rel="stylesheet" type="text/css">
<style>
<%
	if Safari or Opera then
	%>
	html, body {
		height:1000px;
	}
	<%
	end if 
%>
</style>
<script language="JavaScript">
<!--
 
var menuID;
menuID=1;
 
function changeMenu(num)
{
	
	if (num==1) {
		menu = document.getElementById('menu1');	menu.style.visibility = 'visible';
		menu = document.getElementById('menu2');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu3');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu4');	menu.style.visibility = 'hidden';
		menuID=1
		
	}
	if (num==2){
		menu = document.getElementById('menu1');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu2');	menu.style.visibility = 'visible';
		menu = document.getElementById('menu3');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu4');	menu.style.visibility = 'hidden';
		menuID=2
	}
	if (num==3){
		menu = document.getElementById('menu1');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu2');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu3');	menu.style.visibility = 'visible';
		menu = document.getElementById('menu4');	menu.style.visibility = 'hidden';
		menuID=3
	}
	if (num==4){
		menu = document.getElementById('menu1');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu2');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu3');	menu.style.visibility = 'hidden';
		menu = document.getElementById('menu4');	menu.style.visibility = 'visible';
		menuID=4
	}		
	
}
 
 
function checkForm(theForm) {
    var why = "";
    why += checkOrder(theForm.txtName.value);
	why += checkName(theForm.txtName.value);
	why += checkEmail(theForm.txtEmail.value);
    why += checkPhone(theForm.txtContact.value);
    why += checkAddress(theForm.txtAddress.value);
	why += checkPostcode(theForm.txtPostcode.value);
    
    if (why != "") {
       alert(why);
       return false;
    }
	theForm.submit();
	return true;
}
 
function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}
 
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}
 
 
function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a phone number.\n";
}
 
var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "Please enter a valid phone number.\n";
  
    }
    
return error;
}
 
// non-empty textbox
 
function checkName(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your name.\n"
  }
return error;	  
}
function checkOrder(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your order.\n"
  }
return error;	  
}
function checkAddress(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter an address.\n"
  }
return error;	  
}
function checkPostcode(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your postcode.\n"
  }
return error;	  
}
 
function changeLocation(page){
	if (page==1) location = "default.asp?menuID="+menuID
	if (page==2) location = "menu.asp?menuID="+menuID
	if (page==3) location = "business.asp?menuID="+menuID
	if (page==4) location = "contactus.asp?menuID="+menuID
}
 
 
// -->
</script>
 
</head>
 
<body onLoad="changeMenu(<%
if request.QueryString("menuID")<>"" then 
	Response.Write(request.QueryString("menuID"))
else
	Response.Write("0")
end if
%>)">
 
<table border="0" style="width: 100%; height: 100%;">
<tr>
<td style="vertical-align: top;	text-align: center;" class="main">
<div class="container">
 
<div id="top"><img src="images/toptitle.gif" width="800" height="81"></div>
 
<div id="linkbar" style="padding:0px; margin:0px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding:0px; margin:0px;">
  <tr>
    <td>
	<% if Mac then %>
	<a href="default.asp" style="padding-left:15px;" onClick="changeLocation(1);return true;">home</a> 
	<a href="menu.asp" onClick="changeLocation(2);return true;">your order</a> 
	<a href="business.asp" onClick="changeLocation(3);return true;">business lunches</a>
	<a href="contactus.asp" onClick="changeLocation(4);return true;">contact us</a></td>
   
	<% else %>
	<a href="#" style="padding-left:15px;" onClick="changeLocation(1);return true;">home</a> 
	<a href="#" onClick="changeLocation(2);return true;">your order</a> 
	<a href="#" onClick="changeLocation(3);return true;">business lunches</a>
	<a href="#" onClick="changeLocation(4);return true;">contact us</a></td>
    
	<% end if%>
	<td align="right" class="infoText">Tel: 01962 878000 &nbsp;&nbsp; Fax: 01962 866699</td>
  </tr>
</table>	 
</div>
 
<div id="mainarea">
 
<div id="left"><br>

Open in new window

0
 
socrossAuthor Commented:
Thanks for you help so far, bluv11t.
I'm going to be away now for several hours but will pick this up again then.
Time now 17.07 (UK)
Thanks again
socross
0
 
bluV11tCommented:
Hi!

Try removing  CODEPAGE="1252" from the first line of /site/top.asp
0
 
socrossAuthor Commented:
Sorted !
I just had to put in the correct remote mail server (for 1&1) in line 28 of your suggested code above and it all came good.
So thanks very much for your help and speedy response. Full points awarded without hesitation !
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now