From 881458fdfabb4ab897f57a9ff00699f77ac64372 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 17 Mar 2007 15:39:07 +0000 Subject: [PATCH] Fixed a bug in Mail that was fixed on trunk: in send() we change the global headers ($this->headers) and that creates a problem if we want to change the from address, etc. So in send() no longer change that variable. --- mail.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mail.php b/mail.php index 638e853..07f5a11 100644 --- a/mail.php +++ b/mail.php @@ -272,17 +272,17 @@ class Mail $this->bodytext = trim($this->registry->unsanitize($this->bodytext, true)); // attach additional headers - $this->headers = $this->registry->modules['functions']->convert_line_breaks($this->headers, $this->delim); - $this->headers .= ((!preg_match("#{$this->delim}$#", $this->headers) AND $this->headers != '') ? "\n" : '') . "From: \"{$this->fromname}\" <{$this->from}>" . $this->delim; - $this->headers .= "Return-Path: {$this->from}" . $this->delim; - $this->headers .= "X-Mailer: ISSO Mail Framework \$Revision$" . $this->delim; - $this->headers .= "MIME-Version: 1.0" . $this->delim; + $headers = $this->registry->modules['functions']->convert_line_breaks($this->headers, $this->delim); + $headers .= ((!preg_match("#{$this->delim}$#", $headers) AND $headers != '') ? "\n" : '') . "From: \"{$this->fromname}\" <{$this->from}>" . $this->delim; + $headers .= "Return-Path: {$this->from}" . $this->delim; + $headers .= "X-Mailer: ISSO Mail Framework \$Revision$" . $this->delim; + $headers .= "MIME-Version: 1.0" . $this->delim; // see if we need to use mime/multipart if ($sendhtml AND !empty($this->bodyhtml) == true) { $boundary = 'ISSO-MULTIPART-' . $this->registry->modules['functions']->rand(10); - $this->headers .= "Content-Type: multipart/alternative; boundary=\"$boundary\"" . $this->delim; + $headers .= "Content-Type: multipart/alternative; boundary=\"$boundary\"" . $this->delim; $this->bodyhtml = $this->registry->modules['functions']->convert_line_breaks($this->bodyhtml, $this->delim); @@ -305,15 +305,15 @@ class Mail } else { - $this->headers .= "Content-Type: text/plain; charset=\"" . $this->charset . "\"" . $this->delim; + $headers .= "Content-Type: text/plain; charset=\"" . $this->charset . "\"" . $this->delim; $body = $this->bodytext; } - $this->headers .= "Content-Transfer-Encoding: 8bit" . $this->delim; - - $this->headers = trim($this->headers); + $headers .= "Content-Transfer-Encoding: 8bit" . $this->delim; + + $headers = trim($headers); // attempt to send the mail! - if (mail($tostring, $this->subject, $body, $this->headers, "-f {$this->from}")) + if (mail($tostring, $this->subject, $body, $headers, "-f {$this->from}")) { $this->registry->debug("email: sent to $address"); } -- 2.22.5