/** * Sends a email * * @access public * @param string $recipient * @param string $subject * @param string $htmlBody * @param string $textBody * @return number */ public function sendMail($recipient, $subject, $htmlBody, $textBody = false) { $message = \Swift_Message::newInstance(); // Subject $message->setSubject($subject); // From $fromEmail = $this->configurationManager->getSetting('mailer.sendFrom'); $fromName = $this->configurationManager->getSetting('mailer.sendFromName'); $message->setFrom(array($fromEmail => $fromName)); // To $message->setTo($recipient); // HTML body $message->setBody($htmlBody, 'text/html'); // Text body if ($textBody === false) { $textBody = $this->createTextBody($htmlBody); } $message->addPart($textBody, 'text/plain'); $mailer = $this->getMailer(); return $mailer->send($message); }
/** * Returns the setting for the given group and key * * @access public * @param string $path * @return mixed */ public function getSetting($path) { return $this->configurationManager->getSetting($path); }