Solved

Form submission not working after changing website host

Posted on 2008-11-02
11
329 Views
Last Modified: 2012-06-21
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
Comment
Question by:socross
  • 6
  • 5
11 Comments
 
LVL 7

Expert Comment

by:bluV11t
ID: 22861787
Hi!
Could you post the code for confirm.asp where the error occurs?
0
 
LVL 1

Author Comment

by:socross
ID: 22861848
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
 
LVL 7

Accepted Solution

by:
bluV11t earned 500 total points
ID: 22861915
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
 
LVL 1

Author Comment

by:socross
ID: 22861961
So does the configuration code simply go at the top of the page (between lines 1 and 2 of the original confirm.asp) ?
0
 
LVL 7

Expert Comment

by:bluV11t
ID: 22862019
I'd just put it on line 16.  
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:socross
ID: 22862150
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
 
LVL 7

Assisted Solution

by:bluV11t
bluV11t earned 500 total points
ID: 22862182
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
 
LVL 1

Author Comment

by:socross
ID: 22862236
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
 
LVL 1

Author Comment

by:socross
ID: 22862252
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
 
LVL 7

Assisted Solution

by:bluV11t
bluV11t earned 500 total points
ID: 22862465
Hi!

Try removing  CODEPAGE="1252" from the first line of /site/top.asp
0
 
LVL 1

Author Closing Comment

by:socross
ID: 31512458
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to solve this equation 3 52
add custom headers to my mail 2 47
Dreamweaver server behavior gone 6 110
Live mode in DW, need to creae Session 4 77
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

21 Experts available now in Live!

Get 1:1 Help Now