From 559350859ca0ec4e2148c8fa3737bbb877ce2e47 Mon Sep 17 00:00:00 2001 From: bryndivey Date: Thu, 25 May 2006 15:39:00 +0000 Subject: [PATCH] Added SMTP authentication to the config file --- config/config.ini | 7 +++++++ lib/email/Email.inc | 21 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/config/config.ini b/config/config.ini index 3363d97..ec8dea3 100644 --- a/config/config.ini +++ b/config/config.ini @@ -112,6 +112,13 @@ browseToUnitFolder = default [email] ; email settings emailServer = none +emailPort = default + +; do you need auth to connect to SMTP? +emailAuthentication = false +emailUsername = username +emailPassword = password + emailFrom = kt@example.org emailFromName = KnowledgeTree Document Management System ; Set to true to allow users to send attachments from the document diff --git a/lib/email/Email.inc b/lib/email/Email.inc index ccf525d..aac983e 100644 --- a/lib/email/Email.inc +++ b/lib/email/Email.inc @@ -53,14 +53,29 @@ class Email { $this->oMailer->IsHTML(true); $this->oMailer->SetLanguage('en', KT_DIR . '/phpmailer/language/'); $this->bEmailDisabled = false; - $oConfig =& KTConfig::getSingleton(); - $sEmailServer = $oConfig->get('email/emailServer'); - if ($sEmailServer == 'none') { + + $oConfig =& KTConfig::getSingleton(); + $sEmailServer = $oConfig->get('email/emailServer'); + if ($sEmailServer == 'none') { $this->bEmailDisabled = true; } if (empty($sEmailServer)) { $this->bEmailDisabled = true; } + + $sEmailPort = $oConfig->get('email/emailPort'); + if(!empty($sEmailPort)) { + $this->oMailer->Port = (int) $sEmailPort; + } + + $bEmailAuth = $oConfig->get('email/emailAuthentication'); + if($bEmailAuth) { + $sEmailUser = $oConfig->get('email/emailUsername'); + $sEmailPass = $oConfig->get('email/emailPassword'); + $this->oMailer->SMTPAuth = true; + $this->oMailer->Username = $sEmailUser; + $this->oMailer->Password = $sEmailPass; + } } /** -- libgit2 0.21.4