I have moved a friends website from one windows server to another, I haven't touched the coding at all, they have a contact form on this site and a cgi script to handle it, but for some reason the cgi script isn't sending the form. The contact form can be found at
http://www.smartchoicepropertyservic...ontact_us.html
below is the cgi script:
#!/usr/bin/perl
use OLE;
use CGI;
$jmail = CreateObject OLE "JMail.SMTPMail";
print "Content-type: text/html\n\n";
$form = new CGI;
$Recipient=$form->param('EMAIL');
$domain = $ENV {'SERVER_NAME'};
$referer = $ENV {'HTTP_REFERER'};
$url = $referer;
$url =~ s/^http:\/\///i;
$url =~ s/^www\.//i;
$domain =~ s/^www\.//i;
$name = $form->param('NAME');
@type_of_enquiry = $form->param('TYPE_OF_ENQUIRY');
$Sender = "website\@$domain";
$SMTPServer = "smtp.$domain:25";
$Subject = "WEBSITE: Contact Form Submission";
$Body = "------------------------------\n";
$Body .= "WEBSITE CONTACT FORM SUBMITTED\n";
$Body .= "------------------------------\n\n\n";
$Body .= "NAME : " . $form->param('NAME') . "\n\n";
$Body .= "ADDRESS : \n" . $form->param('ADDRESS') . "\n\n";
$Body .= "HOME PHONE : " . $form->param('PHONE_HOME') . "\n\n";
$Body .= "MOBILE PHONE : " . $form->param('PHONE_MOBILE') . "\n\n";
$Body .= "WORK PHONE : " . $form->param('PHONE_WORK') . "\n\n";
$Body .= "EMAIL : " . $form->param('EMAIL') . "\n\n";
$Body .= "TYPE OF ENQUIRY : \n";
foreach $element (@type_of_enquiry) {
$Body .= $element ."\n";
}
$Body .= "------\n" . $form->param('OTHER') . "\n";
$Body .= "\n\nDETAILS :\n" . $form->param('DETAILS') . "\n\n";
$Body .= "------------------End Of Message------------------\n\n";
$Priority = 3;
$Header = "Originating-IP", $ENV{'REMOTE_ADDR'};
$jmail->{ServerAddress} = $SMTPServer;
$jmail->{Sender} = $Sender;
$jmail->{Subject} = $Subject;
$jmail->AddRecipient ("kingstanding\@$domain");
# $jmail->AddRecipientBCC ("cgreen\@blueyonder.co.uk");
$jmail->{Body} = $Body;
$jmail->{Priority} = $Priority;
$jmail->AddHeader ($Header);
if ($url =~ m/^$domain/)
{
$mailmessage = "mail sent";
$jmail->Execute;
}
else
{
$mailmessage = "mail was not sent. Incorrect Referer";
}
print<<"RESPONSE_HTML";
<html>
<head>
<title>Thank You</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../css/styles.css">
<script language="javascript">
<!--
function formComplete(objForm) {
if (objForm.NAME.value == '') {
alert('Please enter your name. Thank You.');
return false;
}
if (objForm.ADDRESS.value == '') {
alert('Please enter your full address. Thank You.');
return false;
}
if (!(telValid(objForm.PHONE_HOME.value))) {
alert('Please enter your home phone number. Thank You.');
return false;
}
if (!(emailValid(objForm.EMAIL.value))) {
alert('Please enter your valid email address. Thank You.');
return false;
}
oneChecked = false;
for (i = 0; i < objForm.TYPE_OF_ENQUIRY.length; i++) {
if (objForm.TYPE_OF_ENQUIRY[i].checked == true) {
oneChecked = true;
}
}
if (oneChecked == false) {
alert('Please select one or more types of enquiry. Thank You.');
return false;
}
return true;
}
function emailValid(inEmail) {
var regexp = /^[a-z][a-z0-9_\.]+@[a-z0-9_\.]+(\.[a-z0-9_]+){1,}\$/;
return (inEmail.match(regexp,'i'));
}
function telValid(inString) {
var regexp = /^[0-9 \+\(\)]+\$/;
return (inString.match(regexp,''));
}
//-->
</script>
<style type="text/css">
<!--
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
.style1 {color: #0066CC}
.style3 {color: #0066CC; font-weight: bold; }
-->
</style></head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table id="Table_01" width="100%" height="116" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="11"><img src="../images/concept_top_01.gif" width="422" height="88" alt=""></td>
<td width="100%" rowspan="3" background="../images/concept_top_02.gif"><img src="../images/concept_top_02.gif" width="6" height="116" alt=""></td>
<td><img src="../images/concept_top_03.gif" width="272" height="88" alt=""></td>
</tr>
<tr>
<td><img src="../images/concept_top_04.gif" width="14" height="18" alt=""></td>
<td width="39" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"> <a href="../index.html">home</a> </td>
<td><img src="../images/concept_top_06.gif" width="23" height="18" alt=""></td>
<td width="58" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"> <a href="../about_us.html">about us</a> </td>
<td><img src="../images/concept_top_08.gif" width="22" height="18" alt=""></td>
<td width="51" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"><img src="../images/spacer.gif" width="1" height="1"><a href="../contact_us.html">contact</a></td>
<td><img src="../images/concept_top_10.gif" width="23" height="18" alt=""></td>
<td width="82" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"><a href="../what_we_do.html">what we do</a></td>
<td><img src="../images/concept_top_12.gif" width="24" height="18" alt=""></td>
<td width="60" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"><a href="../property.html">property</a></td>
<td><img src="../images/concept_top_14.gif" width="26" height="18" alt=""></td>
<td><img src="../images/concept_top_15.gif" width="272" height="18" alt=""></td>
</tr>
<tr>
<td colspan="11"><img src="../images/concept_top_16.gif" width="422" height="10" alt=""></td>
<td><img src="../images/concept_top_17.gif" width="272" height="10" alt=""></td>
</tr>
</table>
<table id="Table_01" width="700" height="317" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="700" height="1" colspan="3"><img src="../images/spacer.gif" width="1" height="1"> </td>
</tr>
<tr>
<td width="184" height="33" align="left" valign="top"><img src="../images/concept_form_response_02.gif" width="184" height="33" alt=""></td>
<td width="15" height="33"><img src="../images/concept_contact_us_03.gif" width="15" height="33" alt=""></td>
<td width="501" height="33"><img src="../images/concept_contact_us_04.gif" width="501" height="33" alt=""></td>
</tr>
<tr>
<td width="184" height="109" align="left" valign="top"><img src="../images/concept_form_response_05.jpg" width="184" height="158" alt=""></td>
<td width="15" height="109" align="left" valign="top" background="../images/concept_contact_us_06.gif"><img src="../images/concept_contact_us_06.gif" width="15" height="209" alt=""></td>
<td width="501" height="109" align="left" valign="top"><p><img src="../images/title_information_received.gif" width="225" height="20"></p>
<p> </p>
<p>Thank you for contacting us. Your request is very important to us and will be processed shortly.<br>
</p>
</td>
</tr>
<tr>
<td width="700" height="45" colspan="3"><img src="../images/spacer.gif" width="700" height="45" alt=""></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="13,64,192,113" href="../what_we_do_selling_your_home.html">
</map>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" bgcolor="#CCCCCC" height="1"><img src="../images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="center" valign="top">©2004 Smart Choice Property Services. All Rights Reserved.<br>
<br>
142 Hawthorn Road Kingstanding Birmingham West Midlands B44 8PX<br>
<strong>telephone::</strong> 0121 382 2000 <strong>fax::</strong> 0121 382 2000</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
RESPONSE_HTML
exit(0);
PLEASE NOTE I didn't write this script, my knowlege of CGI is limited, although I can grasp a basic understanding of what is going on, I can't work out what is wrong with this script can someone please help.
Thanx
Chris