mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Mail Transport use BCC option (#15554)
Option to use BCC instead of to field for emails
This commit is contained in:
@@ -71,7 +71,7 @@ class Mail
|
||||
* @param bool $html
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function send($emails, $subject, $message, bool $html = false, ?bool $embedGraphs = null)
|
||||
public static function send($emails, $subject, $message, bool $html = false, bool $bcc = false, ?bool $embedGraphs = null)
|
||||
{
|
||||
if (is_array($emails) || ($emails = self::parseEmails($emails))) {
|
||||
d_echo("Attempting to email $subject to: " . implode('; ', array_keys($emails)) . PHP_EOL);
|
||||
@@ -82,9 +82,13 @@ class Mail
|
||||
foreach (self::parseEmails(Config::get('email_from')) as $from => $from_name) {
|
||||
$mail->setFrom($from, $from_name);
|
||||
}
|
||||
|
||||
// add addresses
|
||||
$addMethod = $bcc ? 'addBcc' : 'addAddress';
|
||||
foreach ($emails as $email => $email_name) {
|
||||
$mail->addAddress($email, $email_name);
|
||||
$mail->$addMethod($email, $email_name);
|
||||
}
|
||||
|
||||
$mail->Subject = $subject;
|
||||
$mail->XMailer = Config::get('project_name');
|
||||
$mail->CharSet = 'utf-8';
|
||||
|
Reference in New Issue
Block a user