From c2104a3613ed5a991822958ec407a99f3abc2ee0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 23 Sep 2011 22:41:19 -0400 Subject: [PATCH] Stripping - from default Message-ID header. This fixes issues where certiain spamassassin rules would flag EmailComponent messages as spam due to too many - in the messageID. Fixes #2019 --- cake/libs/controller/components/email.php | 2 +- cake/tests/cases/libs/controller/components/email.test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index 63615aff6..3246019cd 100755 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -589,7 +589,7 @@ class EmailComponent extends Object{ if ($this->messageId !== false) { if ($this->messageId === true) { - $headers['Message-ID'] = '<' . String::uuid() . '@' . env('HTTP_HOST') . '>'; + $headers['Message-ID'] = '<' . str_replace('-', '', String::uuid()) . '@' . env('HTTP_HOST') . '>'; } else { $headers['Message-ID'] = $this->messageId; } diff --git a/cake/tests/cases/libs/controller/components/email.test.php b/cake/tests/cases/libs/controller/components/email.test.php index 29998ab2c..d037f46ae 100755 --- a/cake/tests/cases/libs/controller/components/email.test.php +++ b/cake/tests/cases/libs/controller/components/email.test.php @@ -1211,7 +1211,7 @@ HTMLBLOC; $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); $result = $this->Controller->Session->read('Message.email.message'); - $this->assertPattern('/Message-ID: \<[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}@' . env('HTTP_HOST') . '\>\n/', $result); + $this->assertPattern('/Message-ID: \<[a-f0-9]{32}@' . env('HTTP_HOST') . '\>\n/', $result); $this->Controller->EmailTest->messageId = '<22091985.998877@localhost>';