From ecce33ad9bd82f4a0b36924f7e1b90e11ae3a08b Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Tue, 25 Sep 2012 10:57:22 +0000
Subject: [PATCH] Update: SMTP mail class

---
 interface/lib/classes/ispcmail.inc.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php
index d8a70dc44..3086da8c3 100644
--- a/interface/lib/classes/ispcmail.inc.php
+++ b/interface/lib/classes/ispcmail.inc.php
@@ -492,6 +492,9 @@ class ispcmail {
     public function send($recipients) {
         if(!is_array($recipients)) $recipients = array($recipients);
         
+        if($this->use_smtp == true) $this->_crlf = "\r\n";
+        else $this->_crlf = "\n";
+        
         $this->create();
         
         $subject = '';
@@ -547,10 +550,10 @@ class ispcmail {
                 if($recipname && !is_numeric($recipname)) $this->setHeader('To', $recipname . ' <' . $recip . '>');
                 else $this->setHeader('To', $recip);
                 
-                $mail_content = 'To: ' . $this->getHeader('To') . $this->_crlf;
+                $mail_content = 'Subject: ' . $enc_subject . $this->_crlf;
+                $mail_content .= 'To: ' . $this->getHeader('To') . $this->_crlf;
                 if($this->getHeader('Bcc') != '') $mail_content .= 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset) . $this->_crlf;
                 if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf;
-                $mail_content .= 'Subject: ' . $enc_subject . $this->_crlf;
                 $mail_content .= implode($this->_crlf, $headers) . $this->_crlf . $this->_crlf . $this->body;
                 
                 fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf);
-- 
GitLab