From 2386a86adcad9057749a8501caaac9d0ed085f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgaras=20Janu=C5=A1auskas?= Date: Tue, 1 Mar 2016 22:21:14 +0200 Subject: [PATCH] Include Subject and To in email log when using MailTransport --- lib/Cake/Network/Email/CakeEmail.php | 2 +- lib/Cake/Network/Email/MailTransport.php | 3 +++ lib/Cake/Test/Case/Network/Email/MailTransportTest.php | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index bb55333f1..bf62be85a 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -1184,7 +1184,7 @@ class CakeEmail { } CakeLog::write( $config['level'], - PHP_EOL . $contents['headers'] . PHP_EOL . $contents['message'], + PHP_EOL . $contents['headers'] . PHP_EOL . PHP_EOL . $contents['message'], $config['scope'] ); } diff --git a/lib/Cake/Network/Email/MailTransport.php b/lib/Cake/Network/Email/MailTransport.php index 692ca06fe..9e27899d3 100644 --- a/lib/Cake/Network/Email/MailTransport.php +++ b/lib/Cake/Network/Email/MailTransport.php @@ -49,6 +49,9 @@ class MailTransport extends AbstractTransport { $params = isset($this->_config['additionalParameters']) ? $this->_config['additionalParameters'] : null; $this->_mail($to, $subject, $message, $headers, $params); + + $headers .= $eol . 'Subject: ' . $subject; + $headers .= $eol . 'To: ' . $to; return array('headers' => $headers, 'message' => $message); } diff --git a/lib/Cake/Test/Case/Network/Email/MailTransportTest.php b/lib/Cake/Test/Case/Network/Email/MailTransportTest.php index dde5eaa90..73871e781 100644 --- a/lib/Cake/Test/Case/Network/Email/MailTransportTest.php +++ b/lib/Cake/Test/Case/Network/Email/MailTransportTest.php @@ -84,7 +84,10 @@ class MailTransportTest extends CakeTestCase { '-f' ); - $this->MailTransport->send($email); + $result = $this->MailTransport->send($email); + + $this->assertContains('Subject: ', $result['headers']); + $this->assertContains('To: ', $result['headers']); } }