Skip to content
Snippets Groups Projects
Commit 1f946ffc authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #1115 from greezybacon/issue/sys-alerts-no-bounce


email: No bounces for system alerts

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 1fe83a43 a333026d
No related branches found
No related tags found
No related merge requests found
......@@ -25,11 +25,12 @@ class Mailer {
var $ht = array();
var $attachments = array();
var $options = array();
var $smtp = array();
var $eol="\n";
function Mailer($email=null, $options=null) {
function Mailer($email=null, array $options=array()) {
global $cfg;
if(is_object($email) && $email->isSMTPEnabled() && ($info=$email->getSMTPInfo())) { //is SMTP enabled for the current email?
......@@ -46,6 +47,7 @@ class Mailer {
$this->email = $email;
$this->attachments = array();
$this->options = $options;
}
function getEOL() {
......@@ -114,7 +116,12 @@ class Mailer {
'X-Mailer' =>'osTicket Mailer',
);
if ($this->getEmail() instanceof Email)
// Add in the options passed to the constructor
$options = ($options ?: array()) + $this->options;
if (isset($options['nobounce']) && $options['nobounce'])
$headers['Return-Path'] = '<>';
elseif ($this->getEmail() instanceof Email)
$headers['Return-Path'] = $this->getEmail()->getEmail();
//Bulk.
......@@ -285,7 +292,7 @@ class Mailer {
//Emails using native php mail function - if DB connection doesn't exist.
//Don't use this function if you can help it.
function sendmail($to, $subject, $message, $from) {
$mailer = new Mailer();
$mailer = new Mailer(null, array('notice'=>true, 'nobounce'=>true));
$mailer->setFromAddress($from);
return $mailer->send($to, $subject, $message);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment