예제 #1
0
 /**
  * Versendet einen Newsletter
  *
  * @param int $newsletterId
  * @param string|array $recipients
  * @param bool $bcc
  *
  * @return bool
  */
 public function sendNewsletter($newsletterId, $recipients, $bcc = false)
 {
     $settings = $this->config->getSettings(Schema::MODULE_NAME);
     $newsletter = $this->newsletterRepository->getOneById($newsletterId);
     $sender = ['email' => $settings['mail'], 'name' => $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME)['site_title']];
     $this->mailer->reset()->setBcc($bcc)->setFrom($sender)->setSubject($newsletter['title'])->setUrlWeb($this->router->route('newsletter/archive/details/id_' . $newsletterId, true))->setMailSignature($settings['mailsig']);
     if ($newsletter['html'] == 1) {
         $this->mailer->setTemplate('newsletter/layout.email.tpl');
         $this->mailer->setHtmlBody($newsletter['text']);
     } else {
         $this->mailer->setBody($newsletter['text']);
     }
     $this->mailer->setRecipients($recipients);
     return $this->mailer->send();
 }