0

所以我有一个有趣的问题。我们设置这个 PHP 脚本来发送电子邮件,问题是第一组电子邮件 Branch==0 根本不会发送。其余被选中的分支机构将发送电子邮件。我开始怀疑数字“0”是否有问题(我可能错了)

这是代码:

 <?php
   if(!$_POST){echo "Please go back"; exit();}

echo "<form action=\"confirm2.php\" METHOD=\"POST\">";

foreach ($_POST as $key => $value) {
   // echo $key.": ".$value. "<br> ";
    echo "<input type=\"hidden\" name=\"$key\" value=\"$value\">";
}

$message = '';
$DelMonth = $_POST['DelMonth'];
$DelDay = $_POST['DelDay'];
$DelYear = $_POST['DelYear'];
$Teller_Id = $_POST['Teller_Id'];
$First = $_POST['First'];
$Branch = $_POST['Branch'];
$Deposit_Ticket_Currency = $_POST['deposit_tickets_currency'];
$Deposit_Ticket_Coin = $_POST['deposit_tickets_coin'];
$Last = $_POST['Last'];
$FIT100 = $_POST['FIT100'];
$FIT50 = $_POST['FIT50'];
$FIT20 = $_POST['FIT20'];
$FIT10 = $_POST['FIT10'];
$FIT5 = $_POST['FIT5'];
$FIT2 = $_POST['FIT2'];
$FIT1 = $_POST['FIT1'];
$FITTOT=number_format($FIT100+$FIT50+$FIT20+$FIT10+$FIT5+$FIT2+$FIT1,0);
$New_Currency100 = $_POST['New_Currency100'];
$New_Currency50 = $_POST['New_Currency50'];
$New_Currency20 = $_POST['New_Currency20'];
$New_Currency10 = $_POST['New_Currency10'];
$New_Currency5 = $_POST['New_Currency5'];
$New_Currency2 = $_POST['New_Currency2'];
$New_Currency1 = $_POST['New_Currency1'];
$New_CurrencyTOT=number_format($New_Currency100+$New_Currency50+$New_Currency20+$New_Currency10+$New_Currency5+$New_Currency2+$New_Currency1,0);
$Rolled_CoinSusanb = $_POST['Rolled_CoinSusanb'];
$Rolled_CoinDollar = $_POST['Rolled_CoinDollar'];
$Rolled_CoinFifty = $_POST['Rolled_CoinFifty'];
$Rolled_CoinQuarter = $_POST['Rolled_CoinQuarter'];
$Rolled_CoinDimes = $_POST['Rolled_CoinDimes'];
$Rolled_CoinNickels = $_POST['Rolled_CoinNickels'];
$Rolled_CoinPennies = $_POST['Rolled_CoinPennies'];
$Rolled_CoinTOT=number_format($Rolled_CoinSusanb+$Rolled_CoinDollar+$Rolled_CoinFifty+$Rolled_CoinQuarter+$Rolled_CoinDimes+$Rolled_CoinNickels+$Rolled_CoinPennies,2);

$Grand_Tot=number_format($FIT100+$FIT50+$FIT20+$FIT10+$FIT5+$FIT2+$FIT1+$New_Currency100+$New_Currency50+$New_Currency20+$New_Currency10+$New_Currency5+$New_Currency2+$New_Currency1+$Rolled_CoinSusanb+$Rolled_CoinDollar+$Rolled_CoinFifty+$Rolled_CoinQuarter+$Rolled_CoinDimes+$Rolled_CoinNickels+$Rolled_CoinPennies,2);
$comments = $_POST['comments'];

$message .= "<table border=\"1\">";
$message .= "<tr><td>Requested Delivery Date:</td><td>$DelMonth/$DelDay/$DelYear</td></tr>";
$message .= "<tr><td>Requested By: </td><td><b>$Teller_Id</b> -- $First $Last</td></tr>";
$message .= "<tr><td>Branch</td><td>$Branch</td></tr>";
$message .= "<tr><td>Deposit Ticket -- Currency</td><td>$Deposit_Ticket_Currency</td></tr>";
$message .= "<tr><td>Deposit Ticket -- Coins</td><td>$Deposit_Ticket_Coin</td></tr>";
$message .= "<tr><td>Comments</td><td>$comments</td></tr></table>";

$message .= "<hr><table><tr><td colspan=\"2\"><b>For FIT</b></td></tr>";
$message .= "<tr><td>Ones</td><td>$$FIT1</td></tr>";
$message .= "<tr><td>Twos</td><td>$$FIT2</td></tr>";
$message .= "<tr><td>Fives</td><td>$$FIT5</td></tr>";
$message .= "<tr><td>Tens</td><td>$$FIT10</td></tr>";
$message .= "<tr><td>Twenties</td><td>$$FIT20</td></tr>";
$message .= "<tr><td>Fifties</td><td>$$FIT50</td></tr>";
$message .= "<tr><td>Hundreds</td><td>$$FIT100</td></tr>";

$message .= "<tr><td><b><font color=red>Total</font color></b></td><td><b><font color=red>$$FITTOT</font color></b></td></table>";

$message .= "<hr><table><tr><td colspan=\"2\"><b>For New Currency</b></td></tr>";
$message .= "<tr><td>Ones</td><td>$$New_Currency1</td></tr>";
$message .= "<tr><td>Twos</td><td>$$New_Currency2</td></tr>";
$message .= "<tr><td>Fives</td><td>$$New_Currency5</td></tr>";
$message .= "<tr><td>Tens</td><td>$$New_Currency10</td></tr>";
$message .= "<tr><td>Twenties</td><td>$$New_Currency20</td></tr>";
$message .= "<tr><td>Fifties</td><td>$$New_Currency50</td></tr>";
$message .= "<tr><td>Hundreds</td><td>$$New_Currency100</td></tr>";
$message .= "<tr><td><b><font color=red>Total</font color></b></td><td><b><font color=red>$$New_CurrencyTOT</font color></b></td></tr></table>";

$message .= "<hr><table><tr><td colspan=\"2\"><b>For Rolled Coin</b></td></tr>";
$message .= "<tr><td>Pennies</td><td>$$Rolled_CoinPennies</td></tr>";
$message .= "<tr><td>Nickels</td><td>$$Rolled_CoinNickels</td></tr>";
$message .= "<tr><td>Dimes</td><td>$$Rolled_CoinDimes</td></tr>";
$message .= "<tr><td>Quarters</td><td>$$Rolled_CoinQuarter</td></tr>";
$message .= "<tr><td>Fifty Cent Pieces</td><td>$$Rolled_CoinFifty</td></tr>";
$message .= "<tr><td>Susan B's</td><td>$$Rolled_CoinSusanb</td></tr>";
$message .= "<tr><td>Dollar Coins</td><td>$$Rolled_CoinDollar</td></tr>";
$message .= "<tr><td><font color=red><b>Total</b></font color></td><td><b><font color=red>$$Rolled_CoinTOT</font color></b></td></tr></table>";
$message .= "<table><tr><td><font color=red><b>GRAND TOTAL</b></font color></td><td><b><u><font color=green>$$Grand_Tot</font color></u></b></td></tr></table>";
//<font color=red>.</font color>
if($_POST['SendEmail']=='true'){
echo "<h2>Email has been sent!</h2> <a href=\"http://www.google.com\">Click here to exit</a>";
/*
if($Branch==0000){
$to1 ='robb@firstchoiceit.org';
$to1 .='robb@firstchoiceit.org';
}
*/
//Arvada
if($Branch==0){
 /*$to1 ='guilfords@eaglelegacy.org,';*/
 $to1 ='AccountingGroup@partnercoloradocu.org,';
 $to1 .=' guentherk@partnercoloradocu.org,';
 $to1 .=' sierram@partnercoloradocu.org';
 $to1 .=' blagonyal@partnercoloradocu.org';
 }
//Aurora
if($Branch==1){
 /*$to1 ='guilfords@eaglelegacy.org,';*/
 $to1 ='AccountingGroup@partnercoloradocu.org,';
 $to1 .=' nunezj@partnercoloradocu.org,';
 $to1 .=' bernharda@partnercoloradocu.org,';
 $to1 .=' suareza@partnercoloradocu.org';
}

//Littleton
if($Branch==4){
 /*$to1 ='guilfords@eaglelegacy.org,';*/
 $to1 ='AccountingGroup@partnercoloradocu.org,';
 /*$to1 .=' bilbyr@partnercoloradocu.org,';*/
 $to1 .=' gallardom@partnercoloradocu.org,';
 $to1 .=' woodsmallk@partnercoloradocu.org';
}

//Stapleton
if($Branch==5){
/*$to1 ='guilfords@eaglelegacy.org,';*/
$to1 ='AccountingGroup@partnercoloradocu.org,';
$to1 .='oliverj@partnercoloradocu.org,';
$to1 .='suareza@partnercoloradocu.org,';
$to1 .=' morgans@partnercoloradocu.org';
}
//Broomfield
if($Branch==8){
/*$to1 ='guilfords@eaglelegacy.org,';*/
$to1 ='AccountingGroup@partnercoloradocu.org,';
$to1 .=' schuttk@partnercoloradocu.org,';
$to1 .=' kellerm@partnercoloradocu.org';
}
//Denverwater
if($Branch==9){
/*$to1 ='guilfords@eaglelegacy.org,';*/
$to1 ='AccountingGroup@partnercoloradocu.org,';
$to1 .=' curtisc@partnercoloradocu.org,';
$to1 .=' chavezp@partnercoloradocu.org';
}



//Sending Actual Email
$subject1 = 'CASHORDER REQUEST';
$headers1 = 'From: Cash Order ' ."\r\n";
$headers1 .= 'Reply-To:' ."\r\n";
$headers1 .= 'MIME-Version: 1.0' . "\r\n";
$headers1 .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mail_sent = @mail( $to1, $subject1, $message, $headers1 );

exit();
}
else { echo $message; }

echo "<table><h2>Please confirm the amounts are correct & hit the <u>Place Cash Order button</u><br>To make changes, hit the back button in your browser</h2>";
echo "<input type=\"submit\" value=\"Place Cash Order\" style=\"width: 150px; height: 100px;\">";
echo "<input type=\"hidden\" name=\"SendEmail\" value=\"true\">";
echo "</td></tr></table>"
?>
4

1 回答 1

1
if($Branch==0){
/*$to1 ='guilfords@eaglelegacy.org,';*/
$to1 ='AccountingGroup@partnercoloradocu.org,';
$to1 .=' guentherk@partnercoloradocu.org,';
$to1 .=' sierram@partnercoloradocu.org';
$to1 .=' blagonyal@partnercoloradocu.org';
}

您在第三个电子邮件地址之后缺少逗号 - 我怀疑这会在您尝试发送电子邮件时产生错误,因为电子邮件地址的格式错误。

于 2012-05-22T22:42:14.813 回答