public static function sendEmail($from, $to, $subject, $body) { $mailer = MailerService::getMailer(); $message = $mailer->compose(); $message->setSubject($subject); $message->setTo($to); $from = MailerService::prepareEmailAddress($from); $message->setFrom($from[1], $from[0]); $message->setBody($body, 'text/html'); $mailer->send($message); error_log($to . ' - ' . $subject); }
}); /** * If the configuration specify the use of metadata adapter use it or use memory otherwise */ $di->setShared('modelsMetadata', function () { return new MetaDataAdapter(); }); /** * Register the session flash service with the Twitter Bootstrap classes */ $di->set('flash', function () { return new Flash(array('error' => 'alert alert-danger', 'success' => 'alert alert-success', 'notice' => 'alert alert-info', 'warning' => 'alert alert-warning')); }); /** * Start the session the first time some component request the session service */ $di->setShared('session', function () { $session = new SessionAdapter(); $session->start(); return $session; }); /** * Register Mailer Service */ $di->setShared('mailer', function () { $service = new MailerService(); return $service->mailer(); }); $di->set('router', function () { return require __DIR__ . '/routes.php'; });