fix: Update OSTicket transport to use the from email address #5739 (#5927)

This commit is contained in:
Neil Lathwood 2017-03-03 18:22:33 +00:00 committed by GitHub
parent afb838bc10
commit 296360b204
4 changed files with 39 additions and 4 deletions

View File

@ -11,9 +11,15 @@
$url = $opts['url'];
$token = $opts['token'];
foreach (parse_email($config['email_from']) as $from => $from_name) {
$email = $from_name . ' <' . $from . '>';
break;
}
$protocol = array(
'name' => 'LibreNMS',
'email' => $_SERVER['SERVER_NAME'],
'email' => $email,
'subject' => ($obj['name'] ? $obj['name'] . ' on ' . $obj['hostname'] : $obj['title']) ,
'message' => strip_tags($obj['msg']) ,
'ip' => $_SERVER['REMOTE_ADDR'],

View File

@ -870,9 +870,7 @@ function send_mail($emails, $subject, $message, $html = false)
if (is_array($emails) || ($emails = parse_email($emails))) {
$mail = new PHPMailer();
$mail->Hostname = php_uname('n');
if (empty($config['email_from'])) {
$config['email_from'] = '"' . $config['project_name'] . '" <' . $config['email_user'] . '@'.$mail->Hostname.'>';
}
foreach (parse_email($config['email_from']) as $from => $from_name) {
$mail->setFrom($from, $from_name);
}

View File

@ -118,6 +118,9 @@ if (!module_selected('nodb', $init_modules)) {
// load graph types from the database
require $install_dir . '/includes/load_db_graph_types.inc.php';
// Process $config to tidy up
require $install_dir . '/includes/process_config.inc.php';
}
if (file_exists($config['install_dir'] . '/html/includes/authentication/'.$config['auth_mechanism'].'.inc.php')) {

View File

@ -0,0 +1,28 @@
<?php
/**
* process_config.inc.php
*
* LibreNMS file to post process $config into something usable
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if (empty($config['email_from'])) {
$config['email_from'] = '"' . $config['project_name'] . '" <' . $config['email_user'] . '@' . php_uname('n') . '>';
}