嗨,请让我知道我的代码有什么问题
邮件在条件满足时始终在垃圾箱中发送,否则
$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;
}
}
谢谢