| version 1.1, 2005/06/05 12:14:30 |
version 1.2, 2005/11/07 20:37:49 |
| Line 66 class Mail_sendmail extends Mail { |
|
| Line 66 class Mail_sendmail extends Mail { |
|
| * the commandline, we can't guarantee the use of the standard "\r\n" |
* the commandline, we can't guarantee the use of the standard "\r\n" |
| * separator. Instead, we use the system's native line separator. |
* separator. Instead, we use the system's native line separator. |
| */ |
*/ |
| $this->sep = (strstr(PHP_OS, 'WIN')) ? "\r\n" : "\n"; |
$this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n"; |
| } |
} |
| |
|
| /** |
/** |
| Line 110 class Mail_sendmail extends Mail { |
|
| Line 110 class Mail_sendmail extends Mail { |
|
| |
|
| if (!isset($from)) { |
if (!isset($from)) { |
| return PEAR::raiseError('No from address given.'); |
return PEAR::raiseError('No from address given.'); |
| } elseif (strstr($from, ' ') || |
} elseif (strpos($from, ' ') !== false || |
| strstr($from, ';') || |
strpos($from, ';') !== false || |
| strstr($from, '&') || |
strpos($from, '&') !== false || |
| strstr($from, '`')) { |
strpos($from, '`') !== false) { |
| return PEAR::raiseError('From address specified with dangerous characters.'); |
return PEAR::raiseError('From address specified with dangerous characters.'); |
| } |
} |
| |
|
| Line 124 class Mail_sendmail extends Mail { |
|
| Line 124 class Mail_sendmail extends Mail { |
|
| fputs($mail, $text_headers); |
fputs($mail, $text_headers); |
| fputs($mail, $this->sep); // newline to end the headers section |
fputs($mail, $this->sep); // newline to end the headers section |
| fputs($mail, $body); |
fputs($mail, $body); |
| $result = pclose($mail) >> 8 & 0xFF; // need to shift the pclose result to get the exit code |
$result = pclose($mail); |
| |
if (version_compare(phpversion(), '4.2.3') == -1) { |
| |
// With older php versions, we need to shift the |
| |
// pclose result to get the exit code. |
| |
$result = $result >> 8 & 0xFF; |
| |
} |
| } else { |
} else { |
| return PEAR::raiseError('sendmail [' . $this->sendmail_path . '] is not a valid file'); |
return PEAR::raiseError('sendmail [' . $this->sendmail_path . '] is not a valid file'); |
| } |
} |
| |
|
| if ($result != 0) { |
if ($result != 0) { |
| return PEAR::raiseError('sendmail returned error code ' . $result); |
return PEAR::raiseError('sendmail returned error code ' . $result, |
| |
$result); |
| } |
} |
| |
|
| return true; |
return true; |