WordPress.org

Make WordPress Core

Ticket #22492: patchfile.txt

File patchfile.txt, 997 bytes (added by ryderlewis, 2 years ago)

class-phpmailer.php patch

Line 
1--- wp-includes/class-phpmailer.php   Sun Nov 18 01:56:59 2012 +0000
2+++ wp-includes/class-phpmailer.php   Sun Nov 18 03:17:01 2012 +0000
3@@ -1238,11 +1238,17 @@
4     }
5
6     // Add custom headers
7+    $mime_version_encountered = false; // sometimes mime-version is already included in custom headers, and some mail servers reject messages with duplicate mime-version headers.
8     for($index = 0; $index < count($this->CustomHeader); $index++) {
9       $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
10+      if (strcasecmp(trim($this->CustomHeader[$index][0]), 'mime-version') == 0) {
11+         $mime_version_encountered = true;
12+      }
13     }
14     if (!$this->sign_key_file) {
15-      $result .= $this->HeaderLine('MIME-Version', '1.0');
16+      if (!$mime_version_encountered) {
17+         $result .= $this->HeaderLine('MIME-Version', '1.0');
18+      }
19       $result .= $this->GetMailMIME();
20     }