これは、ここで何年も働いていないプログラマーによってクライアントの 1 人のために開発された内部 PHP アプリケーションを使用して、電子メールの爆発を送信するときに呼び出される関数です。
「○通のメールが無事に送信されました!」と表示されますが、一向に届きません。:/
エラーの原因が分からないので、エラーのログをより具体的にする必要があるかもしれません。
誰にも提案はありますか?
function SendBroadCastEmail() {
ini_set("SMTP", "206.196.112.2" );
ini_set('sendmail_from', 'theagencykc@gmail.com');
$clsPortfolio = new Portfolio();
if ($_REQUEST["frmBroadcastGroup"] == "All") {
$strWhere = "";
}elseif ($_REQUEST["frmBroadcastGroup"] == "Active") {
$strWhere = " WHERE p.Active = 1 ";
}elseif ($_REQUEST["frmBroadcastGroup"] == "Custom") {
$selectEmails = array_unique($_REQUEST['frmBroadcastRecipentList']);
$strWhere = " WHERE ";
foreach ($selectEmails as $intRecipent) {
$strWhere .= " OR Portfolio_ID = '$intRecipent' ";
}
$strWhere = str_replace(" WHERE OR", " WHERE ", $strWhere);
}
$clsPortfolio->GetList($strWhere);
if ($rsRecipients = mysql_fetch_array($clsPortfolio->rsResult)) {
do {
if (trim($rsRecipients["Email"]) == "") {
$aryNoEmail[] = array("Name" => stripslashes($rsRecipients["Name"]), "Portfolio_ID" => $rsRecipients["Portfolio_ID"]) ;
}else{
$aryRecipents[] = $rsRecipients["Email"];
}
} while($rsRecipients = mysql_fetch_array($clsPortfolio->rsResult));
}
$strHeaders = "MIME-Version: 1.0\r\n";
$strHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$strHeaders .= "From: theagencykc@gmail.com\r\n";
foreach ($aryRecipents as $strRecipient) {
mail(stripslashes($strRecipient), stripslashes($_REQUEST["frmBroadcastSubject"]),stripslashes( $_REQUEST["frmBroadcastBody"]), $strHeaders);
if (mail(stripslashes($strRecipient), stripslashes($_REQUEST["frmBroadcastSubject"]),stripslashes( $_REQUEST["frmBroadcastBody"]), $strHeaders)) {
echo("<p>Message successfully sent, buddy!</p>");
} else {
echo("<p>Message delivery failed... buddy</p>");
}
}
$strBroadcastResults = "<b>" . count($aryRecipents) . " Emails Sent Successfully<br>";
if (count($aryNoEmail) > 0) {
$strBroadcastResults .= "<u>The following models had no email on file:</u><br>";
foreach ($aryNoEmail as $aryIndividual) {
$strBroadcastResults .= "<a href=\"/docs/edit_portfolio.php?model_id=$aryIndividual[Portfolio_ID]\" target=\"_blank\">$aryIndividual[Name]</a> ,";
}
}
return $strBroadcastResults;
}