diff --git a/OpenVBX/config/email.php b/OpenVBX/config/email.php index b6448fa1..99d0b87a 100644 --- a/OpenVBX/config/email.php +++ b/OpenVBX/config/email.php @@ -5,7 +5,7 @@ See: http://codeigniter.com/user_guide/libraries/email.html | ------------------------------------------------------------------- */ -$config['useragent'] = 'CodeIgniter'; //The "user agent". +$config['useragent'] = 'OpenVBX-'.OpenVBX::version(); //The "user agent". $config['protocol'] = 'mail'; //mail, sendmail, or smtp The mail sending protocol. $config['mailpath'] = '/usr/sbin/sendmail'; //The server path to Sendmail. diff --git a/OpenVBX/helpers/mail_helper.php b/OpenVBX/helpers/mail_helper.php index 9453556f..ddf24b42 100644 --- a/OpenVBX/helpers/mail_helper.php +++ b/OpenVBX/helpers/mail_helper.php @@ -24,19 +24,23 @@ function openvbx_mail($recipient, $subject, $template, $maildata = array()) $ci = &get_instance(); $from_email = $ci->settings->get('from_email', $ci->tenant->id); + if(empty($from_email)) { $domain = $ci->config->item('server_name'); $from_email = "$from "; } - - $headers = 'From: '.$from_email."\r\n"; - $headers .= 'Reply-To: '.$from_email."\r\n"; - $headers .= 'Return-Path: '.$from_email."\r\n"; - $headers .= 'User-Agent: OpenVBX-'.OpenVBX::version(); - + $message = $ci->load->view('emails/'.$template, $maildata, true); + $ci->load->library('email'); + $ci->email->from($from_email); + $ci->email->reply_to($from_email); + $ci->email->to($recipient); + $ci->email->subject('[OpenVBX] '.$subject); + $ci->email->message($message); + log_message('debug', 'MAILING -- to: '.$recipient.' -- body: '.$message); - return mail($recipient, '[OpenVBX] '.$subject, $message, $headers); + + return $ci->email->send(); } \ No newline at end of file diff --git a/system/libraries/Model.php b/system/libraries/Model.php index d77e99b7..7fbaa1eb 100644 --- a/system/libraries/Model.php +++ b/system/libraries/Model.php @@ -66,7 +66,7 @@ function _assign_libraries($use_reference = TRUE) if ($use_reference == TRUE) { $this->$key = NULL; // Needed to prevent reference errors with some configurations - $this->$key =& $CI->$key; + $this->$key = $CI->$key; } } }