From c630bcfca816f625b8cd70a1a7467a77c8065bbd Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Mon, 17 Nov 2008 21:09:45 +0000 Subject: added sendmail debugging and fixed a bug with single to double quoted string syntax in from() --- system/libraries/Email.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'system/libraries/Email.php') diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 94f517c45..89d0976ae 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -189,7 +189,7 @@ class CI_Email { if ( ! preg_match('/[\200-\377]/', $name)) { // add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes - $name = '"'.addcslashes($name, '\0..\37\177"\\').'"'; + $name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"'; } else { @@ -1539,16 +1539,22 @@ class CI_Email { { $fp = @popen($this->mailpath . " -oi -f ".$this->clean_email($this->_headers['From'])." -t", 'w'); - if ( ! is_resource($fp)) + fputs($fp, $this->_header_str); + fputs($fp, $this->_finalbody); + + $status = pclose($fp); + + if (version_compare(PHP_VERSION, '4.2.3') == -1) + { + $status = $status >> 8 & 0xFF; + } + + if ($status == 0) { $this->_set_error_message('email_no_socket'); return FALSE; } - fputs($fp, $this->_header_str); - fputs($fp, $this->_finalbody); - pclose($fp) >> 8 & 0xFF; - return TRUE; } -- cgit v1.2.3-24-g4f1b