电子邮件电子邮件应用程序不会发送电子邮件

时间:2012-11-02 17:06:24

标签: php email smtp

所以当我发送一个电子邮件爆炸使用内部php应用程序时,我的函数会被调用,这个应用程序是由一位在多年没有工作过的程序员为我们的客户开发的。

它说" X电子邮件已成功发送!",但我从未接收过它们。 :/

也许我需要更具体地记录错误,因为我无法找到导致它的原因。

有人有任何建议吗?

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>&nbsp;,";
    }
}
return $strBroadcastResults;
}

0 个答案:

没有答案
相关问题