コード例 #1
0
ファイル: Mail.php プロジェクト: hofmeister/Pimple
 public static function init()
 {
     if (!self::$init) {
         Zend::_use('Zend_Mail');
         if (Settings::get(self::SMTP_HOST, false)) {
             Zend::_use('Zend_Mail_Transport_Smtp');
             $config = array('port' => Settings::get(self::SMTP_PORT, 25));
             if (Settings::get(self::SMTP_USER, false)) {
                 $config['auth'] = 'login';
                 $config['username'] = Settings::get(self::SMTP_USER, '');
                 $config['password'] = Settings::get(self::SMTP_PASS, '');
             }
             if (Settings::get(self::SMTP_SSL, false)) {
                 $config['ssl'] = Settings::get(self::SMTP_SSL);
             }
             $transport = new Zend_Mail_Transport_Smtp(Settings::get(self::SMTP_HOST), $config);
             Zend_Mail::setDefaultTransport($transport);
         }
         self::$init = true;
     }
 }