Skip to content

Commit

Permalink
Adding EmailCompnent::lineFeed property toallow overriding the defaul…
Browse files Browse the repository at this point in the history
…t line feed string when using mail() function to send mail. Closes #1320
  • Loading branch information
ADmad committed Nov 26, 2010
1 parent 156a708 commit 93a46cd
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions cake/libs/controller/components/email.php
Expand Up @@ -94,7 +94,7 @@ class EmailComponent extends Object{
*/
var $bcc = array();
/**
* The date to put in the Date: header. This should be a date
* The date to put in the Date: header. This should be a date
* conformant with the RFC2822 standard. Leave null, to have
* today's date generated.
*
Expand Down Expand Up @@ -147,6 +147,19 @@ class EmailComponent extends Object{
* @access public
*/
var $lineLength = 70;

/**
* Line feed character(s) to be used when sending using mail() function
* If null PHP_EOL is used.
* RFC2822 requires it to be CRLF but some Unix
* mail transfer agents replace LF by CRLF automatically
* (which leads to doubling CR if CRLF is used).
*
* @var string
* @access public
*/
var $lineFeed = null;

/**
* @deprecated see lineLength
*/
Expand Down Expand Up @@ -674,8 +687,13 @@ function __strip($value, $message = false) {
* @access private
*/
function __mail() {
$header = implode("\n", $this->__header);
$message = implode("\n", $this->__message);
if ($this->lineFeed === null) {
$lineFeed = PHP_EOL;
} else {
$lineFeed = $this->lineFeed;
}
$header = implode($lineFeed, $this->__header);
$message = implode($lineFeed, $this->__message);
if (ini_get('safe_mode')) {
return @mail($this->to, $this->__encode($this->subject), $message, $header);
}
Expand Down

0 comments on commit 93a46cd

Please sign in to comment.