CC-4300: System -> Preference: Please add a option let user choose if the SMTP server requires User Authentication

-done
This commit is contained in:
denise 2012-08-28 16:17:37 -04:00
parent 219fba9bee
commit 9d90e8c531
6 changed files with 91 additions and 27 deletions

View file

@ -13,23 +13,31 @@ class Application_Model_Email
public static function send($subject, $message, $tos, $from = null)
{
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
$mailServerRequiresAuth = Application_Model_Preference::GetMailServerRequiresAuth() == true ? true : false;
$success = true;
if ($mailServerConfigured) {
$username = Application_Model_Preference::GetMailServerEmailAddress();
$password = Application_Model_Preference::GetMailServerPassword();
$mailServer = Application_Model_Preference::GetMailServer();
$mailServerPort = Application_Model_Preference::GetMailServerPort();
if (!empty($mailServerPort)) {
$port = Application_Model_Preference::GetMailServerPort();
}
$config = array(
'auth' => 'login',
'ssl' => 'ssl',
'username' => $username,
'password' => $password
);
if ($mailServerRequiresAuth) {
$username = Application_Model_Preference::GetMailServerEmailAddress();
$password = Application_Model_Preference::GetMailServerPassword();
$config = array(
'auth' => 'login',
'ssl' => 'ssl',
'username' => $username,
'password' => $password
);
} else {
$config = array(
'ssl' => 'ssl'
);
}
if (isset($port)) {
$config['port'] = $port;