From 3a11b84432879846000e4d53a3325cf704269e49 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Fri, 31 Jan 2014 22:20:52 +0000 Subject: [PATCH] Send staff alerts as Notice as opposed to AutoRely Some emails providers (e.g gmail/google) won't deliver emails marked bulk/autoreply to group email address. --- include/class.email.php | 2 +- include/class.mailer.php | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/include/class.email.php b/include/class.email.php index e5ebabf40..fc6f9f8f5 100644 --- a/include/class.email.php +++ b/include/class.email.php @@ -160,7 +160,7 @@ class Email { } function sendAlert($to, $subject, $message, $attachments=null, $options=array()) { - $options+= array('bulk' => true); + $options+= array('notice' => true); return $this->send($to, $subject, $message, $attachments, $options); } diff --git a/include/class.mailer.php b/include/class.mailer.php index f3aa6e43e..2699df4ff 100644 --- a/include/class.mailer.php +++ b/include/class.mailer.php @@ -113,19 +113,26 @@ class Mailer { 'Return-Path' => $this->getEmail()->getEmail(), ); - //Set bulk/auto-response headers. - if($options && ($options['autoreply'] or $options['bulk'])) { + + //Bulk. + if (isset($options['bulk']) && $options['bulk']) + $headers+= array('Precedence' => 'bulk'); + + //Auto-reply - mark as autoreply and supress all auto-replies + if (isset($options['autoreply']) && $options['autoreply']) { $headers+= array( + 'Precedence' => 'auto_reply', 'X-Autoreply' => 'yes', - 'X-Auto-Response-Suppress' => 'ALL, AutoReply', + 'X-Auto-Response-Suppress' => 'DR, RN, OOF, AutoReply', 'Auto-Submitted' => 'auto-replied'); - - if($options['bulk']) - $headers+= array('Precedence' => 'bulk'); - else - $headers+= array('Precedence' => 'auto_reply'); } + //Notice (sort of automated - but we don't want auto-replies back + if (isset($options['notice']) && $options['notice']) + $headers+= array( + 'X-Auto-Response-Suppress' => 'OOF, AutoReply', + 'Auto-Submitted' => 'auto-generated'); + if ($options) { if (isset($options['inreplyto']) && $options['inreplyto']) $headers += array('In-Reply-To' => $options['inreplyto']); -- GitLab