Skip to content

Commit

Permalink
Merge pull request #1022 from ceeram/2.2-3452
Browse files Browse the repository at this point in the history
Do not pass 5th argument to mail() when in safe mode

Fixes #3452
  • Loading branch information
markstory committed Dec 13, 2012
2 parents 45f6ade + 53b465d commit 557c8ed
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/Cake/Network/Email/MailTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ public function send(CakeEmail $email) {
$headers = $this->_headersToString($headers, $eol);
$message = implode($eol, $email->message());

$params = null;
if (!ini_get('safe_mode')) {
$params = isset($this->_config['additionalParameters']) ? $this->_config['additionalParameters'] : null;
}

$params = isset($this->_config['additionalParameters']) ? $this->_config['additionalParameters'] : null;
$this->_mail($to, $email->subject(), $message, $headers, $params);
return array('headers' => $headers, 'message' => $message);
}
Expand All @@ -58,16 +54,20 @@ public function send(CakeEmail $email) {
* @param string $subject email's subject
* @param string $message email's body
* @param string $headers email's custom headers
* @param string $params additional params for sending email
* @param string $params additional params for sending email, will be ignored when in safe_mode
* @throws SocketException if mail could not be sent
* @return void
*/
protected function _mail($to, $subject, $message, $headers, $params = null) {
//@codingStandardsIgnoreStart
if (!@mail($to, $subject, $message, $headers, $params)) {
if (ini_get('safe_mode')) {
//@codingStandardsIgnoreStart
if (!@mail($to, $subject, $message, $headers)) {
throw new SocketException(__d('cake_dev', 'Could not send email.'));
}
} elseif (!@mail($to, $subject, $message, $headers, $params)) {
//@codingStandardsIgnoreEnd
throw new SocketException(__d('cake_dev', 'Could not send email.'));
}
//@codingStandardsIgnoreEnd
}

}

0 comments on commit 557c8ed

Please sign in to comment.