diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..e06b7db3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +* text=auto + +/docs export-ignore +/examples export-ignore +/test export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.scrutinizer.yml export-ignore +/.travis.yml export-ignore +/travis.phpunit.xml.dist export-ignore +/SECURITY.md export-ignore +/changelog.md export-ignore +/README.md export-ignore diff --git a/src/PHPMailer.php b/src/PHPMailer.php index cbe552dc..6efa8940 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -201,6 +201,9 @@ class PHPMailer /** * An ID to be used in the Message-ID header. * If empty, a unique id will be generated. + * You can set your own, but it must be in the format "", + * as defined in RFC5322 section 3.6.4 or it will be ignored. + * @see https://tools.ietf.org/html/rfc5322#section-3.6.4 * * @var string */ @@ -2068,6 +2071,8 @@ class PHPMailer $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject))); } + // Only allow a custom message ID if it conforms to RFC 5322 section 3.6.4 + // https://tools.ietf.org/html/rfc5322#section-3.6.4 if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) { $this->lastMessageID = $this->MessageID; } else {