/** * Constructor * @access public * @param string $smtp_dsn SMTP DSN. * @return array Mounts */ public function __construct($smtp_dsn = false) { $this->Observable = new Observable(); $this->Observable->DefineEvents(array( /** * @param PHPSmartyMailer Mailer */ 'BeforeSend' )); $this->Smarty = new Smarty(); $this->Smarty->template_dir = CF_TEMPLATES_PATH; $this->Smarty->compile_dir = CF_SMARTYBIN_PATH; $this->Smarty->cache_dir = CF_SMARTYCACHE_PATH; $this->Smarty->caching = false; if (!$smtp_dsn || $smtp_dsn == "") $this->Mailer = "sendmail"; else { $this->Mailer = "smtp"; // // parseDSN // preg_match_all("/(.+):(.*)@([^:]+):?([0-9]+)?/", $smtp_dsn, $matches); $this->Host = $matches[3][0]; $this->Port = $matches[4][0] ? $matches[4][0] : 25; $this->Username = $matches[1][0]; $this->Password = $matches[2][0]; if ($this->Username && $this->Password) $this->SMTPAuth = true; } }