daily pastebin goal
18%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function build($newsletterId)
  2.     {
  3.         require_once JPATH_ROOT . DS . 'components' . DS . 'com_newsletter' . DS . 'models' . DS . 'cron.php';
  4.         $this->_model = new NewsletterModelCron();
  5.         $params = JComponentHelper::getParams("com_newsletter");
  6.        
  7.         $newsletter = $this->_model->getNewsletter($newsletterId);
  8.         $attachments = $this->_model->getAttachments($newsletterId);
  9.        
  10.         $urlNewsletter = JURI::root() . 'images/newsletter/';
  11.        
  12.         $mail = JFactory::getMailer();
  13.        
  14.         ob_start();
  15.         require JPATH_ROOT . DS . 'components' . DS . 'com_newsletter' . DS . 'views' . DS . 'cron' . DS . 'tmpl' . DS .'default.php';
  16.         $htmlContent = trim(ob_get_contents());
  17.         ob_end_clean();
  18.        
  19.         $mail->setBody($htmlContent);
  20.         $mail->IsHTML();
  21.         $mail->AltBody = $newsletter->nonhtmlcontent;
  22.         $mail->setSubject($newsletter->title);
  23.         $mail->SetFrom($params->get('email_from'));
  24.         foreach ($attachments as $attachment) {
  25.             $mail->addAttachment(JPATH_ROOT . $attachment->path);
  26.         }
  27.        
  28.         return $mail;
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top