Commit 559350859ca0ec4e2148c8fa3737bbb877ce2e47
1 parent
f884b8a3
Added SMTP authentication to the config file
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5441 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
25 additions
and
3 deletions
config/config.ini
| @@ -112,6 +112,13 @@ browseToUnitFolder = default | @@ -112,6 +112,13 @@ browseToUnitFolder = default | ||
| 112 | [email] | 112 | [email] |
| 113 | ; email settings | 113 | ; email settings |
| 114 | emailServer = none | 114 | emailServer = none |
| 115 | +emailPort = default | ||
| 116 | + | ||
| 117 | +; do you need auth to connect to SMTP? | ||
| 118 | +emailAuthentication = false | ||
| 119 | +emailUsername = username | ||
| 120 | +emailPassword = password | ||
| 121 | + | ||
| 115 | emailFrom = kt@example.org | 122 | emailFrom = kt@example.org |
| 116 | emailFromName = KnowledgeTree Document Management System | 123 | emailFromName = KnowledgeTree Document Management System |
| 117 | ; Set to true to allow users to send attachments from the document | 124 | ; Set to true to allow users to send attachments from the document |
lib/email/Email.inc
| @@ -53,14 +53,29 @@ class Email { | @@ -53,14 +53,29 @@ class Email { | ||
| 53 | $this->oMailer->IsHTML(true); | 53 | $this->oMailer->IsHTML(true); |
| 54 | $this->oMailer->SetLanguage('en', KT_DIR . '/phpmailer/language/'); | 54 | $this->oMailer->SetLanguage('en', KT_DIR . '/phpmailer/language/'); |
| 55 | $this->bEmailDisabled = false; | 55 | $this->bEmailDisabled = false; |
| 56 | - $oConfig =& KTConfig::getSingleton(); | ||
| 57 | - $sEmailServer = $oConfig->get('email/emailServer'); | ||
| 58 | - if ($sEmailServer == 'none') { | 56 | + |
| 57 | + $oConfig =& KTConfig::getSingleton(); | ||
| 58 | + $sEmailServer = $oConfig->get('email/emailServer'); | ||
| 59 | + if ($sEmailServer == 'none') { | ||
| 59 | $this->bEmailDisabled = true; | 60 | $this->bEmailDisabled = true; |
| 60 | } | 61 | } |
| 61 | if (empty($sEmailServer)) { | 62 | if (empty($sEmailServer)) { |
| 62 | $this->bEmailDisabled = true; | 63 | $this->bEmailDisabled = true; |
| 63 | } | 64 | } |
| 65 | + | ||
| 66 | + $sEmailPort = $oConfig->get('email/emailPort'); | ||
| 67 | + if(!empty($sEmailPort)) { | ||
| 68 | + $this->oMailer->Port = (int) $sEmailPort; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + $bEmailAuth = $oConfig->get('email/emailAuthentication'); | ||
| 72 | + if($bEmailAuth) { | ||
| 73 | + $sEmailUser = $oConfig->get('email/emailUsername'); | ||
| 74 | + $sEmailPass = $oConfig->get('email/emailPassword'); | ||
| 75 | + $this->oMailer->SMTPAuth = true; | ||
| 76 | + $this->oMailer->Username = $sEmailUser; | ||
| 77 | + $this->oMailer->Password = $sEmailPass; | ||
| 78 | + } | ||
| 64 | } | 79 | } |
| 65 | 80 | ||
| 66 | /** | 81 | /** |