Skip to content

Commit

Permalink
Don't advertise that emails are generated by CakePHP.
Browse files Browse the repository at this point in the history
Refs #5424
  • Loading branch information
ADmad committed Dec 24, 2014
1 parent 4b7de4d commit 80f1347
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
10 changes: 0 additions & 10 deletions src/Network/Email/Email.php
Expand Up @@ -44,13 +44,6 @@ class Email {

use StaticConfigTrait;

/**
* Default X-Mailer
*
* @var string
*/
const EMAIL_CLIENT = 'CakePHP Email';

/**
* Line length - no should more - RFC 2822 - 2.1.1
*
Expand Down Expand Up @@ -787,9 +780,6 @@ public function getHeaders(array $include = array()) {
}

$headers += $this->_headers;
if (!isset($headers['X-Mailer'])) {
$headers['X-Mailer'] = static::EMAIL_CLIENT;
}
if (!isset($headers['Date'])) {
$headers['Date'] = date(DATE_RFC2822);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Network/Email/DebugTransportTest.php
Expand Up @@ -50,13 +50,12 @@ public function testSend() {
$email->messageID('<4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>');
$email->subject('Testing Message');
$date = date(DATE_RFC2822);
$email->setHeaders(array('X-Mailer' => Email::EMAIL_CLIENT, 'Date' => $date));
$email->setHeaders(array('Date' => $date));
$email->expects($this->once())->method('message')->will($this->returnValue(array('First Line', 'Second Line', '.Third Line', '')));

$headers = "From: CakePHP Test <noreply@cakephp.org>\r\n";
$headers .= "To: CakePHP <cake@cakephp.org>\r\n";
$headers .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>\r\n";
$headers .= "X-Mailer: CakePHP Email\r\n";
$headers .= "Date: " . $date . "\r\n";
$headers .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>\r\n";
$headers .= "Subject: Testing Message\r\n";
Expand Down
5 changes: 0 additions & 5 deletions tests/TestCase/Network/Email/EmailTest.php
Expand Up @@ -566,7 +566,6 @@ public function testHeaders() {
$this->CakeEmail->setHeaders(array('X-Something' => 'nice'));
$expected = array(
'X-Something' => 'nice',
'X-Mailer' => 'CakePHP Email',
'Date' => date(DATE_RFC2822),
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8',
Expand All @@ -578,7 +577,6 @@ public function testHeaders() {
$expected = array(
'X-Something' => 'very nice',
'X-Other' => 'cool',
'X-Mailer' => 'CakePHP Email',
'Date' => date(DATE_RFC2822),
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8',
Expand All @@ -593,7 +591,6 @@ public function testHeaders() {
'From' => 'cake@cakephp.org',
'X-Something' => 'very nice',
'X-Other' => 'cool',
'X-Mailer' => 'CakePHP Email',
'Date' => date(DATE_RFC2822),
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8',
Expand All @@ -611,7 +608,6 @@ public function testHeaders() {
'To' => 'cake@cakephp.org, CakePHP <php@cakephp.org>',
'X-Something' => 'very nice',
'X-Other' => 'cool',
'X-Mailer' => 'CakePHP Email',
'Date' => date(DATE_RFC2822),
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8',
Expand All @@ -625,7 +621,6 @@ public function testHeaders() {
'To' => 'cake@cakephp.org, CakePHP <php@cakephp.org>',
'X-Something' => 'very nice',
'X-Other' => 'cool',
'X-Mailer' => 'CakePHP Email',
'Date' => date(DATE_RFC2822),
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=ISO-2022-JP',
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase/Network/Email/SmtpTransportTest.php
Expand Up @@ -380,15 +380,14 @@ public function testSendData() {
$email->messageID('<4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>');
$email->subject('Testing SMTP');
$date = date(DATE_RFC2822);
$email->setHeaders(array('X-Mailer' => Email::EMAIL_CLIENT, 'Date' => $date));
$email->setHeaders(array('Date' => $date));
$email->expects($this->once())
->method('message')
->will($this->returnValue(array('First Line', 'Second Line', '.Third Line', '')));

$data = "From: CakePHP Test <noreply@cakephp.org>\r\n";
$data .= "To: CakePHP <cake@cakephp.org>\r\n";
$data .= "Cc: Mark Story <mark@cakephp.org>, Juan Basso <juan@cakephp.org>\r\n";
$data .= "X-Mailer: CakePHP Email\r\n";
$data .= "Date: " . $date . "\r\n";
$data .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>\r\n";
$data .= "Subject: Testing SMTP\r\n";
Expand Down

0 comments on commit 80f1347

Please sign in to comment.