public function sendReport(Presenter $presenter) { if (!$this->activated) { return; } $notReportedErrors = $this->errorReportingServiceRelEntity->getNotEmailReportedErrors(); if (empty($notReportedErrors)) { return; } $template = $this->templateFactory->createTemplate($presenter, '/templates/Email/errorReport.latte'); $template->errors = $notReportedErrors; $mail = $this->mailMessageFactory->create(); $mail->setFrom($this->emailHeaders['from'])->addTo($this->emailHeaders['to'])->setSubject($this->emailHeaders['subject'] . ' ' . (new \DateTime())->format('Y-m-d H:i'))->setHtmlBody($template); $this->mailer->send($mail); $this->markErrorsAsReported($notReportedErrors, 'EMAIL'); }
/** * Creates basic template (used for presenters) * @param string|NULL $className * @return Nette\Templating\IFileTemplate */ public function createTemplate($className = NULL) { return $this->templateFactory->createTemplate($this, null, $this->lang, $className); }