Exemplo n.º 1
0
Arquivo: Email.php Projeto: saiber/www
 public function __construct(LiveCart $application)
 {
     $this->application = $application;
     $this->set('request', $application->getRequest()->toArray());
     $this->url = $this->application->router->createFullUrl('/', null, true);
     $config = $this->application->getConfig();
     ClassLoader::ignoreMissingClasses();
     if ('SMTP' == $config->get('EMAIL_METHOD')) {
         $server = $config->get('SMTP_SERVER');
         if (!$server) {
             $server = ini_get('SMTP');
         }
         $this->connection = Swift_SmtpTransport::newInstance($server, $config->get('SMTP_PORT'));
         if ($config->get('SMTP_USERNAME')) {
             $this->connection->setUsername($config->get('SMTP_USERNAME'));
             $this->connection->setPassword($config->get('SMTP_PASSWORD'));
         }
     } else {
         if ('FAKE' == $config->get('EMAIL_METHOD')) {
             $this->connection = Swift_Connection_Fake::newInstance();
         } else {
             $this->connection = Swift_MailTransport::newInstance();
         }
     }
     $this->swiftInstance = Swift_Mailer::newInstance($this->connection);
     $this->message = Swift_Message::newInstance();
     $this->setFrom($config->get('MAIN_EMAIL'), $config->get('STORE_NAME'));
     ClassLoader::ignoreMissingClasses(false);
 }