コード例 #1
0
ファイル: Message.php プロジェクト: splitice/radical-mail
 function textBody()
 {
     if ($this->altBody) {
         return $this->altBody;
     }
     $h2t = new Html2Text($this->getBody());
     return $h2t->get_text();
 }
コード例 #2
0
ファイル: lib.php プロジェクト: evltuma/moodle
 /**
  * Constructor.
  *
  * If the HTML source string (or file) is supplied, the class
  * will instantiate with that source propagated, all that has
  * to be done it to call get_text().
  *
  * @param string $html    Source HTML
  * @param array  $options Set configuration options
  */
 function __construct($html = '', $options = array())
 {
     // Call the parent constructor.
     parent::__construct($html, $options);
     // MDL-27736: Trailing spaces before newline or tab.
     $this->entSearch[] = '/[ ]+([\\n\\t])/';
     $this->entReplace[] = '\\1';
 }
コード例 #3
0
ファイル: DataMapperModel.php プロジェクト: hughnguy/php
 /**
  * Sends an email
  * @param \Swift_Message $message An email message
  * @param string $content The message body in HTML
  * @return int The number of recipients the message was delivered to
  */
 protected static function sendEmail(\Swift_Message $message, $content)
 {
     // Lazy mailer instantiation
     if (!self::$mailer) {
         self::$mailer = \Swift_Mailer::newInstance(\Swift_SmtpTransport::newInstance(SMTP_SERVER, SMTP_SERVER_PORT));
     }
     $message->setBody($content, 'text/html', 'utf-8');
     $message->addPart(\Html2Text\Html2Text::convert(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')), 'text/plain', 'utf-8');
     return self::$mailer->send($message);
 }
コード例 #4
0
ファイル: Mail.php プロジェクト: nfephp-org/sped-mdfe
 /**
  * montaMessagem
  *
  * @param string $pathFile
  */
 protected function montaMessagem($pathFile)
 {
     $dom = new Dom();
     $dom->loadXMLFile($pathFile);
     $infMDFe = $dom->getNode('infMDFe', 0);
     $ide = $infMDFe->getElementsByTagName('ide')->item(0);
     $emit = $infMDFe->getElementsByTagName('emit')->item(0);
     $tot = $infMDFe->getElementsByTagName('tot')->item(0);
     $razao = $emit->getElementsByTagName('xNome')->item(0)->nodeValue;
     $nMDF = $ide->getElementsByTagName('nMDF')->item(0)->nodeValue;
     $serie = $ide->getElementsByTagName('serie')->item(0)->nodeValue;
     $dhEmi = !empty($ide->getElementsByTagName('dhEmi')->item(0)->nodeValue) ? $ide->getElementsByTagName('dhEmi')->item(0)->nodeValue : $ide->getElementsByTagName('dEmi')->item(0)->nodeValue;
     $data = date('d/m/Y', DateTime::convertSefazTimeToTimestamp($dhEmi));
     $vCarga = $tot->getElementsByTagName('vCarga')->item(0)->nodeValue;
     $xNome = '';
     $this->msgHtml = $this->renderTemplate($xNome, $data, $nMDF, $serie, $vCarga, $razao);
     $cHTT = new Html2Text($this->msgHtml);
     $this->msgTxt = $cHTT->getText();
     return "MDFe n. {$nMDF} - {$razao}";
 }
コード例 #5
0
 /**
  * Formats a message composed by drupal_mail().
  *
  * @see http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7
  *
  * @param array $message
  *   A message array holding all relevant details for the message.
  *
  * @return string
  *   The message as it should be sent.
  */
 public function format(array $message)
 {
     // Get default mail line endings and merge all lines in the e-mail body
     // separated by the mail line endings.
     $line_endings = Settings::get('mail_line_endings', PHP_EOL);
     $message['body'] = SafeMarkup::set(implode($line_endings, $message['body']));
     // Get applicable format.
     $applicable_format = $this->getApplicableFormat($message);
     // Theme message if format is set to be HTML.
     if ($applicable_format == SWIFTMAILER_FORMAT_HTML) {
         $render = array('#theme' => isset($message['params']['theme']) ? $message['params']['theme'] : 'swiftmailer', '#message' => $message);
         $message['body'] = $this->renderer->renderRoot($render);
         if ($this->config['message']['convert_mode'] || !empty($message['params']['convert'])) {
             $converter = new Html2Text($message['body']);
             $message['plain'] = $converter->get_text();
         }
     }
     // Process any images specified by 'image:' which are to be added later
     // in the process. All we do here is to alter the message so that image
     // paths are replaced with cid's. Each image gets added to the array
     // which keeps track of which images to embed in the e-mail.
     $embeddable_images = array();
     preg_match_all('/"image:([^"]+)"/', $message['body'], $embeddable_images);
     for ($i = 0; $i < count($embeddable_images[0]); $i++) {
         $image_id = $embeddable_images[0][$i];
         $image_path = trim($embeddable_images[1][$i]);
         $image_name = basename($image_path);
         if (Unicode::substr($image_path, 0, 1) == '/') {
             $image_path = Unicode::substr($image_path, 1);
         }
         $image = new stdClass();
         $image->uri = $image_path;
         $image->filename = $image_name;
         $image->filemime = file_get_mimetype($image_path);
         $image->cid = rand(0, 9999999999.0);
         $message['params']['images'][] = $image;
         $message['body'] = preg_replace($image_id, 'cid:' . $image->cid, $message['body']);
     }
     return $message;
 }
コード例 #6
0
ファイル: Mail.php プロジェクト: nfephp-org/sped-cte
 /**
  * zMontaMessagem
  *
  * @param string $pathFile
  */
 protected function zMontaMessagem($pathFile)
 {
     $dom = new Dom();
     $dom->loadXMLFile($pathFile);
     $infCTe = $dom->getNode('infCte', 0);
     $ide = $infCTe->getElementsByTagName('ide')->item(0);
     $dest = $infCTe->getElementsByTagName('dest')->item(0);
     $emit = $infCTe->getElementsByTagName('emit')->item(0);
     $vPrest = $infCTe->getElementsByTagName('vPrest')->item(0);
     $razao = $emit->getElementsByTagName('xNome')->item(0)->nodeValue;
     $nCT = $ide->getElementsByTagName('nCT')->item(0)->nodeValue;
     $serie = $ide->getElementsByTagName('serie')->item(0)->nodeValue;
     $xNome = $dest->getElementsByTagName('xNome')->item(0)->nodeValue;
     $dhEmi = !empty($ide->getElementsByTagName('dhEmi')->item(0)->nodeValue) ? $ide->getElementsByTagName('dhEmi')->item(0)->nodeValue : $ide->getElementsByTagName('dEmi')->item(0)->nodeValue;
     $data = date('d/m/Y', DateTime::convertSefazTimeToTimestamp($dhEmi));
     $vCT = $vPrest->getElementsByTagName('vTPrest')->item(0)->nodeValue;
     $this->aMail[] = !empty($dest->getElementsByTagName('email')->item(0)->nodeValue) ? $dest->getElementsByTagName('email')->item(0)->nodeValue : '';
     $this->msgHtml = $this->zRenderTemplate($xNome, $data, $nCT, $serie, $vCT, $razao);
     $cHTT = new Html2Text($this->msgHtml);
     $this->msgTxt = $cHTT->getText();
     return "CTe n. {$nCT} - {$razao}";
 }
コード例 #7
0
 /**
  * Process the email properties correctly to be able to correctly configure the SwiftMailer Email object.
  * @param  string|array $to To whom the notification should be sent.
  * @param  array $message All the email properties.
  *
  * @return array The array of all allowed properties for SwiftMailer Email object.
  */
 protected function processEmailProperties($to, $message)
 {
     // If the notification is only a string, create it a email as the notification being the subject of the email
     $original_message = $message;
     if (!is_array($message)) {
         $message = array('subject' => substr(strip_tags($original_message), 0, 75) . '...', 'body' => $original_message);
     }
     //Checks is the message is a HTML message, and generate the plain text version of it.
     $body = $message['body'];
     if (!is_array($body)) {
         $body_encode = mb_detect_encoding($body);
         $body = htmlspecialchars_decode(htmlentities($body, ENT_NOQUOTES, $body_encode), ENT_NOQUOTES);
         $message['body'] = array('html' => $body, 'plain' => Html2Text::convert($body));
     }
     // Merge and Overwrite configurations.
     $message = array_merge($this->config, $message);
     $recipients = $this->handleEmailRecipientsProperties($to);
     $body = $this->handleEmailBodyProperties($message);
     $advancedProperties = $this->handleAdvancedEmailProperties($message);
     $emailProperties = array_merge($recipients, $body, $advancedProperties);
     return $emailProperties;
 }
コード例 #8
0
 protected function getText($source = false)
 {
     $source = new Html2Text($source);
     return $source->get_text();
 }
コード例 #9
0
 public function send(Participant $participant)
 {
     $mail = $this->_em->getRepository('BdeReventBundle:Mail')->findOneBy(array('type' => $participant->getType()));
     $content = $this->generateMailFromData($mail, $participant);
     $this->mailgun->sendMessage($this->mailgun_domain, array('from' => 'GALA 20 <*****@*****.**>', 'to' => $participant->getEmail(), 'subject' => $content['subject'], 'text' => Html2Text::convert($content['body']), 'html' => $content['body']));
 }
コード例 #10
0
 public function sendToSubscriber($campaign, $subscriber, $use_massmailer = false)
 {
     $html = $campaign->renderForSubscriber($subscriber);
     $text = Html2Text::convert(str_replace(array("\r", "\n"), "", $html));
     if ($use_massmailer) {
         if (!defined('MAILHOST')) {
             define('MAILHOST', 'okaytick.com');
         }
         $backup_original_mailer = Mail::getSwiftMailer();
         // Setup our other mailer if needed
         $transport = Swift_SmtpTransport::newInstance('okaytick.com', 25);
         // 'ssl', 'tls'
         $transport->setUsername('okaytick');
         $transport->setPassword('2e76656dcba6562ffeb68d524de1053e90a229a0');
         // Any other mailer configuration stuff needed...
         $massmailer = new Swift_Mailer($transport);
         Mail::setSwiftMailer($massmailer);
         $to_email = array($subscriber->email => '');
         //          $to_email = array('*****@*****.**' => 'Dominic O\'Brien', '*****@*****.**' => 'Clive Whittaker', '*****@*****.**' => 'Clive Whittaker', '*****@*****.**' => 'Clive Whittaker', '*****@*****.**' => 'Clive Whittaker');
         //          $to_email = array('*****@*****.**' => '');
         $subject = $campaign->subject;
         $subject = str_replace("oktick.com", "okaytick.com", $subject);
         $subject = str_replace("https", "http", $subject);
         $html = str_replace("oktick.com", "okaytick.com", $html);
         $html = str_replace("https", "http", $html);
         $text = str_replace("oktick.com", "okaytick.com", $text);
         $text = str_replace("https", "http", $text);
         // Create the message
         $message = Swift_Message::newInstance()->setReturnPath('*****@*****.**')->setSubject($subject)->setFrom(array('*****@*****.**' => 'OKTicK Search Ltd'))->setTo($to_email)->setBody($html, 'text/html')->addPart($text, 'text/plain')->setId($subscriber->id . ".8938145113." . time() . "@aruba1.generated")->setReplyTo(array('*****@*****.**' => 'OKTicK Search Ltd'))->setSender(array('*****@*****.**' => 'OKTicK Search Ltd'))->setPriority(3);
         $numSent = $massmailer->send($message);
         // Restore our original mailer
         Mail::setSwiftMailer($backup_original_mailer);
         return $numSent;
         /*****************************************************************************************
                     $setUrl = "http://okaytick.com/api.php";
                     $setReturnPath = "*****@*****.**";
                     $setFrom = array('*****@*****.**' => 'OKTicK Search Ltd');
                     $setId = $subscriber->id . ".".$campaign->id."." . time() ."@oktick.generated";
                     $setReplyTo = array('*****@*****.**' => 'OKTicK Search Ltd');
                     $setSender = array('*****@*****.**' => 'OKTicK Search Ltd');
                     $setPriority = 3; // normal
         
                     $query = array(
                         "setReturnPath"=>$setReturnPath,
                         "setSubject" => $campaign->subject,
                         "setFrom" => $setFrom,
                         "setTo" => $subscriber->email,
                         "setBody" => $html,
                         "addPart" => $text,
                         "setId" => $setId,
                         "setReplyTo" => $setReplyTo,
                         "setBody" => $html,
                         "setSender" => $setSender,
                         "setPriority" => $setPriority,
                     );
                     $query = json_encode($query);
                     $query = $this->encrypt ( $query ,$this->ENCRYPTION_KEY );
                     $query = urlencode($query);
                     $query = '__PAYLOAD__=' . $query;
                     $ch = curl_init();
                     //set the url, number of POST vars, POST data
                     curl_setopt($ch,CURLOPT_URL,$setUrl);
                     curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
                     curl_setopt($ch,CURLOPT_POST,1);
                     curl_setopt($ch,CURLOPT_POSTFIELDS,$query);
                     $result = curl_exec($ch);
                     return $result;
         *****************************************************************************************/
     } else {
         Mail::rawTo($subscriber, ['html' => $html, 'text' => $text], function ($message) use($campaign, $subscriber) {
             $message->subject($campaign->subject)->setReturnPath('*****@*****.**')->setFrom(array('*****@*****.**' => 'OKTicK Search Ltd'))->setReplyTo(array('*****@*****.**' => 'OKTicK Search Ltd'))->setId($subscriber->id . "." . time() . "@oktick.generated");
         });
         return true;
     }
 }
コード例 #11
0
 /**
  * Convert html to text
  * @param  string $html
  * @return string
  */
 private function htmlToText($html)
 {
     $converter = new Html2Text($html);
     return $converter->getText();
 }
コード例 #12
0
ファイル: Email.php プロジェクト: openclerk/emails
 static function compile($template_id, $arguments = array())
 {
     $template = false;
     $subject = false;
     $html_template = false;
     $template_dir = \Openclerk\Config::get('emails_templates', __DIR__ . '/../../../../emails');
     if (file_exists($template_dir . "/" . $template_id . ".txt")) {
         $template = file_get_contents($template_dir . "/" . $template_id . ".txt");
         // strip out the subject from the text
         $template = explode("\n", $template, 2);
         $subject = $template[0];
         $template = $template[1];
     }
     if (file_exists($template_dir . "/" . $template_id . ".html")) {
         $html_template = file_get_contents($template_dir . "/" . $template_id . ".html");
         if (file_exists($template_dir . "/" . "layout.html")) {
             $html_layout_template = file_get_contents($template_dir . "/" . "layout.html");
             $html_template = \Openclerk\Templates::replace($html_layout_template, array('content' => $html_template));
         }
         // strip out the title from the html
         $matches = false;
         if (preg_match("#<title>(.+)</title>#im", $html_template, $matches)) {
             $subject = $matches[1];
         }
         $html_template = preg_replace("#<title>.+</title>#im", "", $html_template);
     }
     if (!$template) {
         if ($html_template) {
             // use html2text to generate the text body automatically
             $template = \Html2Text\Html2Text::convert($html_template);
         } else {
             throw new MailerException("Email template '{$template_id}' did not exist within '{$template_dir}'");
         }
     }
     // replace variables
     $template = \Openclerk\Templates::replace($template, $arguments);
     $subject = \Openclerk\Templates::replace($subject, $arguments);
     if ($html_template) {
         $html_template = \Openclerk\Templates::replace($html_template, $arguments);
     }
     // inline CSS?
     if (file_exists($template_dir . "/layout.css")) {
         $css = file_get_contents($template_dir . "/layout.css");
         // custom CSS?
         if (\Openclerk\Config::get("emails_additional_css", false)) {
             $css .= file_get_contents(\Openclerk\Config::get("emails_additional_css", false));
         }
         $emogrifier = new \Pelago\Emogrifier();
         $emogrifier->setHtml($html_template);
         $emogrifier->setCss($css);
         $html_template = $emogrifier->emogrify();
     }
     return array('subject' => $subject, 'html' => $html_template, 'text' => $template);
 }
コード例 #13
0
ファイル: Renderer.php プロジェクト: mb-tec/zf-email
 /**
  * @param $tpl
  * @param array $variables
  * @return array
  */
 protected function _getTemplateData($tpl, array $variables = [])
 {
     $tplData = explode('######', $this->_renderMail($tpl, $variables));
     $tplData = array_map('trim', $tplData);
     foreach ($tplData as $row) {
         $parts = array_map('trim', explode(':', $row, 2));
         switch (strtolower($parts[0])) {
             case 'subject':
                 $subject = $parts[1];
                 break;
             case 'html':
                 $html = $parts[1];
                 break;
             case 'plain':
                 $plain = $parts[1];
                 break;
             default:
         }
     }
     if (!isset($subject)) {
         $subject = 'Missing subject';
     }
     if (!isset($html)) {
         $html = 'Missing html content';
     }
     if (!isset($plain)) {
         $htmlConverter = new Html2Text($html);
         $plain = $htmlConverter->getText();
     }
     return array($subject, $html, $plain);
 }
コード例 #14
0
ファイル: SMTP.php プロジェクト: splitice/radical-mail
 private function multipartMessage($htmlpart, $boundary)
 {
     if ($this->altBody == "") {
         $h2t = new Html2Text($htmlpart);
         $this->altBody = $h2t->get_text();
         //$this->altBody = strip_tags ( $htmlpart, '<br>' );
         //$this->altBody = str_replace(array("\r\n","\n","\t"),' ', $this->altBody);
         //$this->altBody = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $this->altBody);
     }
     $altBoundary = $this->generateBoundary();
     ob_start();
     // Turn on output buffering
     $parts = "This is a multi-part message in MIME format." . $this->newline . $this->newline;
     $parts .= "--" . $boundary . $this->newline;
     $parts .= "Content-Type: multipart/alternative;" . $this->newline;
     $parts .= "    boundary=\"{$altBoundary}\"" . $this->newline . $this->newline;
     $parts .= "--" . $altBoundary . $this->newline;
     $parts .= "Content-Type: text/html; charset={$this->charset}" . $this->newline;
     $parts .= "Content-Transfer-Encoding: {$this->transferEncodeing}" . $this->newline . $this->newline;
     $parts .= $htmlpart . $this->newline . $this->newline;
     $parts .= "--" . $altBoundary . $this->newline;
     $parts .= "Content-Type: text/plain; charset={$this->charset}" . $this->newline;
     $parts .= "Content-Transfer-Encoding: {$this->transferEncodeing}" . $this->newline . $this->newline;
     $parts .= $this->altBody . $this->newline . $this->newline;
     $parts .= "--" . $altBoundary . "--" . $this->newline . $this->newline;
     if (count($this->attachments) > 0) {
         for ($i = 0; $i < count($this->attachments); $i++) {
             $attachment = chunk_split(base64_encode(file_get_contents($this->attachments[$i])));
             $filename = basename($this->attachments[$i]);
             $ext = pathinfo($filename, PATHINFO_EXTENSION);
             $parts .= "--" . $boundary . $this->newline;
             $parts .= "Content-Type: application/{$ext}; name=\"{$filename}\"" . $this->newline;
             $parts .= "Content-Transfer-Encoding: base64" . $this->newline;
             $parts .= "Content-Disposition: attachment; filename=\"{$filename}\"" . $this->newline . $this->newline;
             $parts .= $attachment . $this->newline;
         }
     }
     $parts .= "--" . $boundary . "--";
     return $parts;
 }
コード例 #15
0
ファイル: ClassFactory.php プロジェクト: xstefanox/sapone
 /**
  * {@inheritdoc}
  */
 public function createService(SimpleXMLElement $service)
 {
     // read the service name
     $serviceName = (string) $service['name'];
     $serviceClassName = $serviceName;
     $serviceClassName = filter_var($serviceClassName, FILTER_CALLBACK, array('options' => array($this, 'sanitizeVariableName')));
     $serviceClassName = filter_var($serviceClassName, FILTER_CALLBACK, array('options' => array($this, 'sanitizeConstantName')));
     /*
      * CLASS CREATION
      */
     // create the class
     $class = ClassGenerator::fromReflection(new ClassReflection('\\Sapone\\Template\\ServiceTemplate'));
     $class->setName($serviceClassName);
     $class->setNamespaceName($this->namespaceInflector->inflectNamespace($service));
     // set the correct inheritance
     if ($this->config->isBesimpleClient()) {
         $class->setExtendedClass('BeSimpleSoapClient');
         $class->addUse('BeSimple\\SoapClient\\SoapClient');
     } else {
         $class->setExtendedClass('\\SoapClient');
     }
     // read the service documentation
     $serviceDoc = new DocBlockGenerator();
     $serviceDoc->setTag(new GenericTag('xmlns', '@todo'));
     $documentation = new Html2Text((string) current($service->xpath('./wsdl:documentation')));
     if ($documentation->getText()) {
         $serviceDoc->setShortDescription($documentation->getText());
     }
     $class->setDocBlock($serviceDoc);
     /*
      * METHODS CREATION
      */
     foreach ($service->xpath('.//wsdl:operation') as $operation) {
         $operationName = (string) $operation['name'];
         $operationName = filter_var($operationName, FILTER_CALLBACK, array('options' => array($this, 'sanitizeVariableName')));
         $operationName = filter_var($operationName, FILTER_CALLBACK, array('options' => array($this, 'sanitizeConstantName')));
         $inputMessageType = $this->getTypeFromQualifiedString((string) current($operation->xpath('.//wsdl:input/@message')), $operation);
         $outputMessageType = $this->getTypeFromQualifiedString((string) current($operation->xpath('.//wsdl:output/@message')), $operation);
         // read the service documentation
         $messageDoc = new DocBlockGenerator();
         $documentation = new Html2Text((string) current($operation->xpath('./wsdl:documentation')));
         $param = new ParameterGenerator('parameters', $inputMessageType);
         $messageDoc->setTag(new ParamTag($param->getName(), $this->namespaceInflector->inflectDocBlockQualifiedName($inputMessageType)));
         $messageDoc->setTag(new ReturnTag($this->namespaceInflector->inflectDocBlockQualifiedName($outputMessageType)));
         if ($documentation->getText()) {
             $messageDoc->setShortDescription($documentation->getText());
         }
         // create the method
         $method = new MethodGenerator($operationName);
         $method->setDocBlock($messageDoc);
         $method->setParameter($param);
         $method->setBody("return \$this->__soapCall('{$operation['name']}', array(\$parameters));");
         $class->addMethodFromGenerator($method);
     }
     $this->serializeClass($class);
     // register the class in the classmap
     $this->classmap[$class->getName()] = $class->getNamespaceName() . '\\' . $class->getName();
     return $class->getName();
 }
コード例 #16
0
ファイル: MailNFe.php プロジェクト: fmertins/nfephp
 /**
  * zMontaMessagem
  *
  * @param string $pathFile
  */
 protected function zMontaMessagem($pathFile)
 {
     $dom = new Dom();
     $dom->loadXMLFile($pathFile);
     $infNFe = $dom->getNode('infNFe', 0);
     $ide = $infNFe->getElementsByTagName('ide')->item(0);
     $dest = $infNFe->getElementsByTagName('dest')->item(0);
     $emit = $infNFe->getElementsByTagName('emit')->item(0);
     $icmsTot = $infNFe->getElementsByTagName('ICMSTot')->item(0);
     $razao = $emit->getElementsByTagName('xNome')->item(0)->nodeValue;
     $nNF = $ide->getElementsByTagName('nNF')->item(0)->nodeValue;
     $serie = $ide->getElementsByTagName('serie')->item(0)->nodeValue;
     $xNome = $dest->getElementsByTagName('xNome')->item(0)->nodeValue;
     $dhEmi = !empty($ide->getElementsByTagName('dhEmi')->item(0)->nodeValue) ? $ide->getElementsByTagName('dhEmi')->item(0)->nodeValue : $ide->getElementsByTagName('dEmi')->item(0)->nodeValue;
     $data = date('d/m/Y', DateTime::convertSefazTimeToTimestamp($dhEmi));
     $vNF = $icmsTot->getElementsByTagName('vNF')->item(0)->nodeValue;
     $this->aMail[] = !empty($dest->getElementsByTagName('email')->item(0)->nodeValue) ? $dest->getElementsByTagName('email')->item(0)->nodeValue : '';
     //pega os emails que existirem em obsCont
     $infAdic = $infNFe->getElementsByTagName('infAdic')->item(0);
     if (!empty($infAdic)) {
         $obsConts = $infAdic->getElementsByTagName('obsCont');
         foreach ($obsConts as $obsCont) {
             if (strtoupper($obsCont->getAttribute('xCampo')) === 'EMAIL') {
                 $this->aMail[] = $obsCont->getElementsByTagName('xTexto')->item(0)->nodeValue;
             }
         }
     }
     $this->msgHtml = $this->zRenderTemplate($xNome, $data, $nNF, $serie, $vNF, $razao);
     $this->msgTxt = utf8_encode(Html2Text::convert(utf8_decode($this->msgHtml)));
     return "NFe n. {$nNF} - {$razao}";
 }
コード例 #17
0
ファイル: Notification.php プロジェクト: HeraldOfArms/Herald
 public function getMessageAsPlainText(array $config = [])
 {
     if (empty($config)) {
         $config = ['do_links' => 'none'];
     }
     $html = new Html2Text($this->message, $config);
     return $html->getText();
 }
コード例 #18
0
ファイル: MailHelper.php プロジェクト: zepi/turbo-base
 /**
  * Convert the html of the body to text
  * 
  * @access protected
  * @param string $html
  * @return string
  */
 protected function createTextBody($html)
 {
     $text = \Html2Text\Html2Text::convert($html);
     return $text;
 }