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; + } } /**