From ceb86b23e8b81d09532e5c4699af48129ea1cb74 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 21 Feb 2005 04:05:22 +0000 Subject: [PATCH] All line breaks are now LF (http://us4.php.net/manual/en/function.mail.php). We leave headers as such because the NB says that poor mailers will not send it, but it's a one-way street. Also, to follow the rest of send(), the headers are now stored in the object, not as a separate variable. --- mail.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/mail.php b/mail.php index cd07a1d..3516682 100644 --- a/mail.php +++ b/mail.php @@ -113,15 +113,14 @@ class Mail $this->body = trim($_isso->unsanitize($this->body)); } - $headers = $this->_convert_line_breaks($this->headers, "\n"); - $headers .= "From \"{$this->fromname}\" <{$this->from}>\n"; - $headers .= "Return-Path: {$this->from}\n"; - $headers .= "X-Mailer: ISSO Mail Framework \$Revision$\n"; - $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; - $headers .= "Content-Transfer-Encoding: 7bit\n"; - $headers = trim($headers); + $this->headers = $this->_convert_line_breaks($this->headers); + $this->headers .= "From: \"{$this->fromname}\" <{$this->from}>\n"; + $this->headers .= "Return-Path: {$this->from}\n"; + $this->headers .= "X-Mailer: ISSO Mail Framework \$Revision$\n"; + $this->headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; + $this->headers .= "Content-Transfer-Encoding: 7bit\n"; - if (mail($this->to, $this->subject, $this->body, $headers, "-f {$this->from}")) + if (mail($this->to, $this->subject, $this->body, trim($this->headers), "-f {$this->from}")) { $_isso->debug("email: sent -> good"); return true; @@ -143,7 +142,7 @@ class Mail function _fetch_first_line($string) { $string = $this->_convert_line_breaks($string); - $broken = explode("\r\n", $string); + $broken = explode("\n", $string); return $broken[0]; } @@ -151,11 +150,11 @@ class Mail * Changes line breaks into one format * * @param str Text - * @param str New line break (default is Windows DOS format) + * @param str New line break (default is UNIX format) * * @return str Text with one type of line break */ - function _convert_line_breaks($text, $convert_to = "\r\n") + function _convert_line_breaks($text, $convert_to = "\n") { return preg_replace("#(\r|\n|\r\n)#s", $convert_to, trim($text)); } -- 2.22.5