added sendmail debugging and fixed a bug with single to double quoted string syntax in from()
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 94f517c..89d0976 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -189,7 +189,7 @@
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 @@
{
$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;
}