コード例 #1
0
ファイル: Mail.php プロジェクト: jhonleandres/teste
 /**
  * envia
  * rotina de envio do email com o xml da NFe
  * @param string $fileNfePath
  * @param string $addresses
  * @param boolean $comPdf
  * @param string $pathPdf
  * @return string
  */
 public function envia($fileNfePath = '', $addresses = '', $comPdf = false, $pathPdf = '')
 {
     $aPara = array();
     if (!is_file($fileNfePath)) {
         return '';
     }
     $addresses = str_replace(',', ';', $addresses);
     if (!is_array($addresses)) {
         $aPara = explode(';', $addresses);
     } else {
         $aPara = $addresses;
     }
     if (!is_file($pathPdf)) {
         $pathPdf = '';
         $comPdf = false;
     }
     $objMail = new MailNFe($this->aMailConf);
     $resp = $objMail->envia($fileNfePath, $aPara, $comPdf, $pathPdf);
     $this->error = $objMail->error;
     return $resp;
 }
コード例 #2
0
ファイル: ToolsNFe.php プロジェクト: eliasdanielmelo/nfephp
 /**
  * enviaMail
  * Envia a NFe por email aos destinatários
  * Caso $aMails esteja vazio serão obtidos os email do destinatário  e 
  * os emails que estiverem registrados nos campos obsCont do xml
  * @param string $pathXml
  * @param array $aMails
  * @param string $templateFile path completo ao arquivo template html do corpo do email
  * @param boolean $comPdf se true o sistema irá renderizar o DANFE e anexa-lo a mensagem
  * @return boolean
  * @throws Exception\RuntimeException
  */
 public function enviaMail($pathXml = '', $aMails = array(), $templateFile = '', $comPdf = false)
 {
     $mail = new MailNFe($this->aMailConf);
     $pathPdf = '';
     if ($comPdf && $this->modelo == '55') {
         $docxml = Files\FilesFolders::readFile($pathXml);
         $danfe = new Extras\Danfe($docxml, 'P', 'A4', $this->aDocFormat['pathLogoFile'], 'I', '');
         $id = $danfe->montaDANFE();
         $pathPdf = $this->aConfig['pathNFeFiles'] . DIRECTORY_SEPARATOR . $this->ambiente . DIRECTORY_SEPARATOR . 'pdf' . DIRECTORY_SEPARATOR . $id . '.pdf';
         $pdf = $danfe->printDANFE($pathPdf, 'F');
     }
     if ($mail->envia($pathXml, $aMails, $comPdf, $pathPdf) === false) {
         throw new Exception\RuntimeException('Email não enviado. ' . $mail->error);
     }
     return true;
 }
コード例 #3
0
ファイル: ToolsNFe.php プロジェクト: italobandeira/nfephp
 /**
  * enviaMail
  * Envia a NFe por email aos destinatários
  * Caso $aMails esteja vazio serão obtidos os email do destinatário  e 
  * os emails que estiverem registrados nos campos obsCont do xml
  * @param string $pathXml
  * @param array $aMails
  * @param string $templateFile path completo ao arquivo template html do corpo do email
  * @param boolean $comPdf se true o sistema irá renderizar o DANFE e anexa-lo a mensagem
  * @return boolean
  */
 public function enviaMail($pathXml = '', $aMails = array(), $templateFile = '', $comPdf = false)
 {
     $mail = new MailNFe($this->aMailConf);
     if ($templateFile != '') {
         $mail->setTemplate($templateFile);
     }
     return $mail->envia($pathXml, $aMails, $comPdf);
 }