Thank you so much...
But....I am back to the original code, and I get this...
Invalid Admin Email Id
<?php
include_once 'Holder.php';
$stories = (isset ($REQUEST["stories"]) ? $REQUEST["stories"] : 0);
$sqFeetFirstFloor = (isset($REQUEST["sqFeetFirstFloor"]) ? $REQUEST["sqFeetFirstFloor"] : 0);
$commonFactor = 20;
$priceWall = 1.97;
$priceAttic = 1.75;
$storyEquivalent = 9;
$airSealingRate = 640;
$utilityRebateMax = 2000;
$utilityRebatePercent = 0.75;
$federalTaxRebatePercent = 0.1;
$federalTaxRebateMax = 1500;
$airSealingRebate = 640;
$techRebatePercent = 0.08;
$fromMailId = "topdogdesign@topdogdesign.org";
$domain = "http://www.woodywoodstrecker.com/onlinecalc/index.php";
if($stories == "" || $stories == 0 || $sqFeetFirstFloor == "" || $sqFeetFirstFloor == 0) {
die ("Invalid Input parameters for computation");
}
if(!isset ($REQUEST['custEmailId']) || $REQUEST['custEmailId'] == "") {
die ("Invalid Customer Email Id");
}
if(!isset ($REQUEST['adminEmailId']) || $REQUEST['adminEmailId'] == "") {
die ("Invalid Admin Email Id");
}
//story equvalance 1 x 9
$storyAggregate = $stories * $storyEquivalent;
//factorised sq ft = walls
$totalWalls = $sqFeetFirstFloor / $commonFactor;
//wall perimeter
$wallPerimeter = (($commonFactor 2) + ($totalWalls 2));
$wallArea = ($wallPerimeter $storyAggregate);
//wall rates
$wallRates = ($wallArea $priceWall);
//attic rates
$atticArea = ($commonFactor $totalWalls);
$atticRates = ($atticArea $priceAttic);
//total = attic + wall + airsealing
$totalProjectCost = $atticRates + $wallRates + $airSealingRate;
$federalRebate = $federalTaxRebatePercent $totalProjectCost;
if($federalRebate > $federalTaxRebateMax) {
$federalRebate = $federalTaxRebateMax;
}
$techRebate = $techRebatePercent $totalProjectCost;
$utilityRebate = $utilityRebatePercent * $totalProjectCost;
if($utilityRebate > $utilityRebateMax) {
$utilityRebate = $utilityRebateMax;
}
$totalRebates = ($utilityRebate + $airSealingRebate + $federalRebate + $techRebate);
$finalProjectCost = $totalProjectCost - $totalRebates;
//var_dump($totalProjectCost);
//var_dump($finalProjectCost);
//var_dump($totalRebates);
//emailing
//Mail send for the registered user
ini_set ("SMTP","localhost");
ini_set ("sendmail_from", $fromMailId);
-=-=-=- MIME BOUNDARY
$mime_boundary = "----Americal Building Technologies----".md5(time());
-=-=-=- MAIL HEADERS
$to = $_REQUEST['custEmailId'];
//$to = "topdogdesign@topdogdesign.org";//
$subject = "Proposal From Americal Building Technologies";
$data = file_get_contents("ConsumerEmailContent.php");
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $fromMailId . "\r\n" .
'Reply-To: ' . $fromMailId . "\r\n" .
// 'Bcc: topdogdesign@topdogdesign.org' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
-=-=-=- SEND MAIL
$mailContent = "";
if($data !== false) {
$mailContent = str_ireplace("CUSTOMER_NAME", (isset($REQUEST['custName']) ? $REQUEST['custName'] : ""), $data);
$mailContent = str_ireplace("CUSTOMER_STREET_ADDRESS", (isset($REQUEST['custStreetAddress']) ? $REQUEST['custStreetAddress'] : ""), $mailContent);
$mailContent = str_ireplace("CUSTOMER_CITY", (isset($REQUEST['custCity']) ? $REQUEST['custCity'] : ""), $mailContent);
$mailContent = str_ireplace("CUSTOMER_PHONE_NUMBER", (isset($REQUEST['custPhone']) ? $REQUEST['custPhone'] : ""), $mailContent);
$mailContent = str_ireplace("CUSTOMER_EMAIL_ID", (isset($REQUEST['custEmailId']) ? $REQUEST['custEmailId'] : ""), $mailContent);
$mailContent = str_ireplace("CURRENT_DATE", date("m/d/Y"), $mailContent);
$mailContent = str_ireplace("SQUARE_FOOTAGE_ATTIC", number_format($atticArea, 2), $mailContent);
$mailContent = str_ireplace("COST_ATTIC", number_format($atticRates, 2), $mailContent);
$mailContent = str_ireplace("SQUARE_FOOTAGE_WALL", number_format($wallArea, 2), $mailContent);
$mailContent = str_ireplace("COST_WALL", number_format($wallRates, 2), $mailContent);
$mailContent = str_ireplace("COST_AIR_SEALING", number_format($airSealingRate, 2), $mailContent);
$mailContent = str_ireplace("TOTAL_PROJECT_COST", number_format($totalProjectCost, 2), $mailContent);
$mailContent = str_ireplace("UTILITY_REBATE", number_format($utilityRebate, 2), $mailContent);
$mailContent = str_ireplace("FEDERAL_REBATE", number_format($federalRebate, 2), $mailContent);
$mailContent = str_ireplace("AIR_SEALING_REBATE", number_format($airSealingRebate, 2), $mailContent);
$mailContent = str_ireplace("TECH_REBATE", number_format($techRebate, 2), $mailContent);
$mailContent = str_ireplace("TOTAL_REBATE", number_format($totalRebates, 2), $mailContent);
$mailContent = str_ireplace("FINAL_PROJECT_COST", number_format($finalProjectCost, 2), $mailContent);
$mailContent = str_ireplace(":πOMAIN::", $domain, $mailContent);
}
//var_dump($mailContent);exit();
if (mail($to, $subject, $mailContent, $headers, "-f $fromMailId -r $fromMailId")) {
echo("<p>Message sent to customer !!</p>");
} else {
echo("<p>Message delivery failed for customer!! Please try again !!</p>");
}
//admin mail
//$data = file_get_contents("AdminEmailContent.php");
$to = $REQUEST['adminEmailId'];
//$mailContent = "";
//if($data !== false) {
// $mailContent = str_ireplace("CLIENT_NAME", (isset($REQUEST['custName']) ? $REQUEST['custName'] : ""), $data);
// $mailContent = str_ireplace("CLIENT_ADDRESS", ((isset($REQUEST['custStreetAddress']) ? $REQUEST['custStreetAddress'] : "").(isset($REQUEST['custCity']) ? $REQUEST['custCity'] : "")), $mailContent);
// $mailContent = str_ireplace("CLIENT_PHONE_NUMBER", (isset($REQUEST['custPhone']) ? $REQUEST['custPhone'] : ""), $mailContent);
// $mailContent = str_ireplace("CLIENT_EMAIL_ADDRESS", (isset($REQUEST['custEmailId']) ? $_REQUEST['custEmailId'] : ""), $mailContent);
// $mailContent = str_ireplace("NO_OF_STORIES", $stories, $mailContent);
// $mailContent = str_ireplace("SQUARE_FOOTAGE", $sqFeetFirstFloor, $mailContent);
// $mailContent = str_ireplace("ATTIC_RATE", $atticRates, $mailContent);
// $mailContent = str_ireplace("WALL_RATE", $wallRates, $mailContent);
// $mailContent = str_ireplace("TOTAL_PROJECT_COST", $totalProjectCost, $mailContent);
// $mailContent = str_ireplace("UTILITY_REBATE", $utilityRebate, $mailContent);
// $mailContent = str_ireplace("FEDERAL_REBATE", $federalRebate, $mailContent);
// $mailContent = str_ireplace("OUT_OF_POCKET_COST", $finalProjectCost, $mailContent);
//}
//var_dump($mailContent);exit();
if (mail($to, $subject, $mailContent, $headers, "-f $fromMailId -r $fromMailId")) {
echo("<p>Message sent to admin !!</p>");
} else {
echo("<p>Message delivery failed for admin!! Please try again !!</p>");
}
?>