mirror of
https://github.com/moudsen/mailGraph
synced 2025-10-30 17:17:40 +01:00
v2.14 - Adding ability to set 'From' address details in configuration
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
// Added ability to locate latest problems for testing purposes
|
||||
// 2.12 2023/07/02 - Mark Oudsen - Replaced SwiftMailer with PHPMailer (based on AutoTLS)
|
||||
// 2.13 2023/07/03 - Mark Oudsen - Bugfixes speciifally on links into Zabbix (missing context or info)
|
||||
// 2.14 2023/07/10 - Mark Oudsen - Adding ability to set 'From' address details in configuration
|
||||
// 2.14 2023/07/10 - Mark Oudsen - Adding ability to set 'From' address in configuration
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// (C) M.J.Oudsen, mark.oudsen@puzzl.nl
|
||||
@@ -599,6 +599,15 @@
|
||||
$p_smtp_from_name = 'mailGraph';
|
||||
if (isset($config['smtp_from_name'])) { $p_smtp_from_name = $config['smtp_from_name']; }
|
||||
|
||||
// >>> Backwards compatibility but smtp_from_address is leading (<v2.14)
|
||||
$mailFrom = '';
|
||||
if (isset($config['mail_from'])) { $mailFrom = $config['mail_from']; }
|
||||
|
||||
if (($p_smtp_from_address=='') && ($mailFrom!=''))
|
||||
{
|
||||
$p_smtp_from_address = $mailFrom;
|
||||
}
|
||||
|
||||
$p_graph_match = 'any';
|
||||
if ((isset($config['graph_match'])) && ($config['graph_match']=='exact')) { $p_graph_match = 'exact'; }
|
||||
|
||||
@@ -635,9 +644,6 @@
|
||||
$z_api_pass = $config['zabbix_api_pwd'];
|
||||
}
|
||||
|
||||
// Mail sender
|
||||
$mailFrom = $config['mail_from'];
|
||||
|
||||
// Derived variables - do not change!
|
||||
$z_server = $p_URL; // Zabbix server URL from config
|
||||
$z_url_api = $z_server ."api_jsonrpc.php"; // Zabbix API URL
|
||||
@@ -1419,15 +1425,8 @@
|
||||
}
|
||||
|
||||
// --- Define from
|
||||
if ($p_smtp_from_address!='')
|
||||
{
|
||||
$mail->Sender = $p_smtp_from_address;
|
||||
$mail->SetFrom($p_smtp_from_address, $p_smtp_from_name, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mail->setFrom($mailFrom, $p_smtp_from_name);
|
||||
}
|
||||
$mail->Sender = $p_smtp_from_address;
|
||||
$mail->SetFrom($p_smtp_from_address, $p_smtp_from_name, FALSE);
|
||||
|
||||
// --- Add recipient
|
||||
$mail->addAddress($p_recipient);
|
||||
|
||||
Reference in New Issue
Block a user