0

こんにちは私のコードで何が間違っているか教えてください

メール条件が if not else の場合は、常にジャンク ボックスに送信します

$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