Example #1
0
 public function log()
 {
     $mailLog = null;
     /** @var \Zend\Mail\Transport\Smtp $mailTransport */
     $mailTransport = $this->sxMail->getTransport();
     if ($mailTransport instanceof \Zend\Mail\Transport\Smtp || is_callable([$mailTransport, 'getConnection'])) {
         $mailLog = $mailTransport->getConnection()->getLog();
     }
     if ($mailLog) {
         $this->logger->debug($mailLog);
     }
 }
Example #2
0
 /**
  * @param  Entity\Note $note
  * @param  array $users
  * @param  Entity\User $owner
  * @param  string $subject
  * @param  string $title
  * @return void
  */
 protected function sendNoteGroupMail(Entity\Note $note, array $users, Entity\User $owner, $subject, $title)
 {
     /** @var Entity\User $user */
     foreach ($users as $user) {
         if ($user->getId() != $owner->getId() && true === $user->getNotifications()) {
             $this->translator->setLocale($user->getLanguage());
             $subject = $this->translator->translate($subject);
             $content = new ViewModel();
             $content->setTemplate('mail/note.phtml')->setVariable('title', $title)->setVariable('note', $note)->setVariable('host', $this->host);
             $message = $this->SxMail->compose($content);
             $message->addTo($user->getEmail());
             $message->addFrom($this->defaultFrom);
             $message->setSubject($subject);
             $this->SxMail->send($message);
         }
     }
     // @todo this will only work, as long owner is the only one with edit permissions
     $this->translator->setLocale($owner->getLanguage());
     return;
 }