0

嗨,请让我知道我的代码有什么问题

邮件在条件满足时始终在垃圾箱中发送,否则

$comObj = new companies();
$companyData = $comObj->getCompanyDataPDF ( $params );

$companyData[0]['term_condition'] = nl2br($companyData[0]['term_condition']);
$proposalData = $objProposal->getSavedData ( $id );

$mergeData = array_merge ( array ('companyData' => $companyData ), array ('proposalData' => $proposalData ) );

$htmlcontent = $this->view->partial("companyapi/pdf.phtml", $mergeData);

require_once('html2fpdf/html2pdf.class.php');

$name_of_pdf = trim($proposalData[0]['proposal_name']).'pdf_'.time().'.pdf';

$pdf = new HTML2PDF('P', 'A4', 'fr');


$pdf->WriteHTML($htmlcontent);

$new_pdf= $pdf->Output('', 'S');


$filepath= PUBLIC_PATH.'tempPdf/'.$name_of_pdf;
$rootpathforcheckfile = IMG_HARD_DRIVE_PATH.'tempPdf/'.$name_of_pdf;
$temp_array = array();

$temp_array["pdf"] = $new_pdf;
$temp_array["pdf_name"] = $name_of_pdf;

$customername="Customer";
$companyname="";
if($params ['customerName']){
$customername=$params ['customerName'];
}
if($companyData[0]['name']){
$companyname=$companyData[0]['name'];
}

if(isset($proposalData[0]['proposal_name']) && $proposalData[0]['proposal_name'] != ''){
$subject = (string)strtoupper($proposalData[0]['proposal_name']);

}else {
$subject = "Proposal Mail";
}
$sndemail =Email_Mailer::sendMail($subject,'Please find attached proposal',$customername,$params ['custEmail'],$temp_array,$companyname,$companyData[0]['email']);

我的邮件功能 :::

public static function sendMail($subject,$message,$recipentname='',$recipentemail,$filesPathArray,$sendername='',$senderemail)
    {  
        try 
         {
             $mail = new Zend_Mail();
             $mail->setBodyHtml($formated_msg);
             $mail->setFrom($senderemail);
             $mail->addTo($recipentemail,$recipentname);
             $mail->addCc($senderemail,$sendername);
             $mail->setSubject($subject);
             //attachments code
             if( !empty($filesPathArray) )
             { 

                      $at = new Zend_Mime_Part($filesPathArray["pdf"]);
                      $at->type = 'pdf';
                      $at->filename = $filesPathArray["pdf_name"];
                      $at->disposition = Zend_Mime::DISPOSITION_INLINE;
                      $at->encoding = Zend_Mime::ENCODING_BASE64;
                     $mail->addAttachment($at);

             } else {

             }

              $mail->send();  
             return true;
         }
         catch (Zend_Mail_Transport_Exception $e) 
         {
             //throw $e;
             return false;
         }
         catch (Zend_Mail_Protocol_Exception $e)
         {
             //throw $e;
             return false;
         }
         catch (Zend_Exception $e)
         {
             //throw $e;
             return false;
         }
    } 

谢谢

4

1 回答 1

0

大概您要发送到的邮件系统将邮件标记为垃圾邮件。您应该在那里进行调查,并可能在 serverfault 上重新提出这个问题。

鉴于消息的一般性,我并不完全感到惊讶。要么努力使邮件详细信息更清楚地显示其中包含的内容(因此它不会触发过滤器),要么查看 dkim 之类的东西来证明你是谁,这样它就不再被标记了。

于 2013-10-30T10:52:19.387 回答