diff --git a/config.php.in b/config.php.in index 2697878..761e365 100644 --- a/config.php.in +++ b/config.php.in @@ -202,6 +202,8 @@ $config['PILER_PORT'] = 25; $config['SMARTHOST'] = ''; $config['SMARTHOST_PORT'] = 25; +$config['SMARTHOST_USER'] = ''; +$config['SMARTHOST_PASSWORD'] = ''; $config['SMTP_DOMAIN'] = 'yourdomain.com'; $config['SMTP_FROMADDR'] = 'no-reply@yourdomain.com'; $config['ADMIN_EMAIL'] = 'admin@yourdomain.com'; diff --git a/webui/model/mail/mail.php b/webui/model/mail/mail.php index bbd7c5f..96926e4 100644 --- a/webui/model/mail/mail.php +++ b/webui/model/mail/mail.php @@ -3,7 +3,7 @@ class ModelMailMail extends Model { - public function send_smtp_email($smtphost, $smtpport, $yourdomain, $from, $to = [], $msg, $username = "", $password = ""){ + public function send_smtp_email($smtphost, $smtpport, $yourdomain, $from, $to = [], $msg){ require_once 'Zend/Mail/Protocol/Smtp.php'; require_once 'Zend/Mail/Protocol/Smtp/Auth/Login.php'; @@ -32,10 +32,11 @@ $config['name'] = $yourdomain; try { - if($username && $password) { + $config['username'] = SMARTHOST_USER; + $config['password'] = SMARTHOST_PASSWORD; + + if($config['username'] && $config['password']) { $config['auth'] = 'login'; - $config['username'] = $username; - $config['password'] = $password; $connection = new Zend_Mail_protocol_Smtp_Auth_Login($smtphost, $smtpport, $config); } else { $connection = new Zend_Mail_protocol_Smtp($smtphost, $smtpport, $config);