From e2fd07aa8492e24edc41974256aed7a9d309b050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Tue, 25 Sep 2018 14:41:13 +0200 Subject: [PATCH] - Added E-Mail Header Precedence:bulk and Auto-submitted: auto-generated to CI Mail Lib - Sancho Mails are sent now with the new Mail Headers --- application/helpers/hlp_sancho_helper.php | 2 +- application/libraries/MailLib.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index c788f1bbf..f063365ec 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -66,7 +66,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $body = _parseMailContent('Sancho_Mail_Template', $layout); // Send mail - $ci->maillib->send('sancho@'. DOMAIN, $to, $subject, $body); + $ci->maillib->send('sancho@'. DOMAIN, $to, $subject, $body, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = true, $autogenerated = true); } /** diff --git a/application/libraries/MailLib.php b/application/libraries/MailLib.php index 0871273b5..6d0a48f73 100644 --- a/application/libraries/MailLib.php +++ b/application/libraries/MailLib.php @@ -19,7 +19,7 @@ class MailLib * Class constructor */ public function __construct() - { + { // Set the counter to 0 $this->sended = 0; @@ -46,7 +46,7 @@ class MailLib /** * Sends a single email */ - public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '') + public function send($from, $to, $subject, $message, $alias = '', $cc = null, $bcc = null, $altMessage = '', $bulk = false, $autogenerated = false) { // If from is not specified then use the standard one if (is_null($from) || $from == '') @@ -90,6 +90,11 @@ class MailLib $this->ci->email->message($message); if (!isEmptyString($altMessage)) $this->ci->email->set_alt_message($altMessage); + if($bulk) + $this->ci->email->set_header('Precedence', 'bulk'); + if($autogenerated) + $this->ci->email->set_header('Auto-Submitted', 'auto-generated'); + // Avoid printing on standard output ugly error messages $result = @$this->ci->email->send();