From 60cab52636f2f81aee0b33bb23394000a6285ed5 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 20 Feb 2014 17:03:55 -0600
Subject: [PATCH] oops: Don't crash on setting Return-Path

---
 include/class.mailer.php | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/class.mailer.php b/include/class.mailer.php
index 1c43398bc..3db4a3623 100644
--- a/include/class.mailer.php
+++ b/include/class.mailer.php
@@ -104,15 +104,16 @@ class Mailer {
                 ($this->getEmail()?$this->getEmail()->getEmail():'@osTicketMailer'));
 
         $headers = array (
-                'From' => $this->getFromAddress(),
-                'To' => $to,
-                'Subject' => $subject,
-                'Date'=> date('D, d M Y H:i:s O'),
-                'Message-ID' => $messageId,
-                'X-Mailer' =>'osTicket Mailer',
-                'Return-Path' => $this->getEmail()->getEmail(),
-               );
-
+            'From' => $this->getFromAddress(),
+            'To' => $to,
+            'Subject' => $subject,
+            'Date'=> date('D, d M Y H:i:s O'),
+            'Message-ID' => $messageId,
+            'X-Mailer' =>'osTicket Mailer',
+        );
+
+        if ($this->getEmail() instanceof Email)
+            $headers['Return-Path'] = $this->getEmail()->getEmail();
 
         //Bulk.
         if (isset($options['bulk']) && $options['bulk'])
-- 
GitLab