/** * @return void */ protected static function set_conf_from_yaml() { $conf = (array) Config::inst()->get('SmtpMailer', 'conf'); // die(print_r($conf,1)); if (!empty($conf)) { self::$conf = self::array_merge_recursive_distinct(self::$conf, $conf); } }
/** * creates and configures the mailer */ public function __construct($host = false, $user = false, $pass = false, $encryption = 'fallback', $charset = false, $cssfile = false, $SMTPDebug = 'fallback', $logfailedemail = false) { parent::__construct($host, $user, $pass, $encryption, $charset); if ($cssfile === false) { $cssfile = Config::inst()->get('EmogrifiedSmtpMailer', 'cssfile'); } if ($SMTPDebug === 'fallback') { $SMTPDebug = Config::inst()->get('EmogrifiedSmtpMailer', 'SMTPDebug'); } if ($logfailedemail === false) { $logfailedemail = Config::inst()->get('EmogrifiedSmtpMailer', 'logfailedemail'); } $this->setCSSfile($cssfile); if ($SMTPDebug) { $this->setSMTPDebug($SMTPDebug); } $this->setLogfailedemail($logfailedemail); }
/** * sendmail * * @access public * @param array $email * @param string $subject * @param string $content * @param string $charset * @return mixed */ public static function sendmail($email, $subject, $content, $charset = 'UTF-8') { if (empty($email) || empty($subject) || empty($content)) { return false; } $E_LEVEL = error_reporting(); error_reporting(0); $content = '<html><head><meta http-equiv="Content-Type" content="text/html;charset=' . $charset . '"></head><body>' . $content . '</body></html>'; $mailer = new SmtpMailer(self::$smtp_config); # $mailer->debug(true); $result = $mailer->sendmail($email, $subject, $content, $charset); # echo '<pre>'; print_r($mailer->loginfo()); echo '</pre>'; error_reporting($E_LEVEL); return $result; }
} // --------------------------------- // // Allow override in dev and stage mode for testing asset pipeline // --------------------------------- // if (!empty($_GET['env']) && (APPLICATION_ENV == 'staging' || APPLICATION_ENV == 'development')) { Director::set_environment_type(SS_LoadConf::translate_env($_GET['env'])); } // --------------------------------- // // DB // --------------------------------- // $databaseConfig = array("type" => 'MySQLDatabase', "server" => $ss_cnf->db->host, "username" => $ss_cnf->db->user, "password" => $ss_cnf->db->pass, "database" => $ss_cnf->db->name, "path" => ''); Config::inst()->update('MySQLDatabase', 'connection_charset', 'utf8'); // --------------------------------- // // Mail // --------------------------------- // SmtpMailer::set_conf($ss_cnf->mail); // --------------------------------- // // Misc // --------------------------------- // // Set the site locale i18n::set_locale('en_NZ'); ini_set("date.timezone", "Pacific/Auckland"); // define some Constants if (!defined('THEME_PATH')) { define('THEME_PATH', 'themes/' . Config::inst()->get('SSViewer', 'current_theme')); } if (!defined('PROJECT_PATH')) { define('PROJECT_PATH', $project); } if (!defined('UPLOADS_PATH')) { define('UPLOADS_PATH', 'assets/Uploads');