/** * Sends the email * * @return bool */ public function send() { try { $this->configure(); $this->phpMailer->Subject = $this->generateSubject(); if (is_array($this->from) === true) { $this->phpMailer->setFrom($this->from['email'], $this->from['name']); } else { $this->phpMailer->setFrom($this->from); } $this->generateBody(); // Add attachments to the E-mail if (count($this->attachments) > 0) { foreach ($this->attachments as $attachment) { if (!empty($attachment) && is_file($attachment)) { $this->phpMailer->addAttachment($attachment); } } } if (!empty($this->recipients)) { return $this->bcc === true ? $this->sendBcc() : $this->sendTo(); } } catch (\phpmailerException $e) { $this->logger->error('mailer', $e); } catch (\Exception $e) { $this->logger->error('mailer', $e); } return false; }
/** * @param callable $callback * * @return bool|int * @throws \Doctrine\DBAL\ConnectionException */ public function executeTransactionalQuery(callable $callback) { $this->connection->beginTransaction(); try { $result = $callback(); $this->connection->commit(); } catch (\Exception $e) { $this->connection->rollBack(); $this->logger->error('database', $e); $result = false; } return $result; }
/** * @param \Exception $e */ public function handleException($e) { $this->logger->error('exception', $e); exit(255); }