mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix wrong line ending in email header when using MailTransport.
This commit is contained in:
parent
b99b71e7cc
commit
dbb77bf125
1 changed files with 7 additions and 4 deletions
|
@ -32,7 +32,10 @@ class MailTransport extends AbstractTransport {
|
||||||
* @throws SocketException When mail cannot be sent.
|
* @throws SocketException When mail cannot be sent.
|
||||||
*/
|
*/
|
||||||
public function send(CakeEmail $email) {
|
public function send(CakeEmail $email) {
|
||||||
$eol = PHP_EOL;
|
|
||||||
|
// https://github.com/cakephp/cakephp/issues/2209
|
||||||
|
// https://bugs.php.net/bug.php?id=47983
|
||||||
|
$eol = "\r\n";
|
||||||
if (isset($this->_config['eol'])) {
|
if (isset($this->_config['eol'])) {
|
||||||
$eol = $this->_config['eol'];
|
$eol = $this->_config['eol'];
|
||||||
}
|
}
|
||||||
|
@ -40,11 +43,11 @@ class MailTransport extends AbstractTransport {
|
||||||
$to = $headers['To'];
|
$to = $headers['To'];
|
||||||
unset($headers['To']);
|
unset($headers['To']);
|
||||||
foreach ($headers as $key => $header) {
|
foreach ($headers as $key => $header) {
|
||||||
$headers[$key] = str_replace(array("\r", "\n"), '', $header);
|
$headers[$key] = str_replace("\r\n", '', $header);
|
||||||
}
|
}
|
||||||
$headers = $this->_headersToString($headers, $eol);
|
$headers = $this->_headersToString($headers, $eol);
|
||||||
$subject = str_replace(array("\r", "\n"), '', $email->subject());
|
$subject = str_replace("\r\n", '', $email->subject());
|
||||||
$to = str_replace(array("\r", "\n"), '', $to);
|
$to = str_replace("\r\n", '', $to);
|
||||||
|
|
||||||
$message = implode($eol, $email->message());
|
$message = implode($eol, $email->message());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue