Fix $cid assembly

This commit is contained in:
Marcus Bointon 2025-10-06 09:21:07 +02:00
parent 73afb4a8b1
commit 54b2ab00d3
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
1 changed files with 3 additions and 3 deletions

View File

@ -4604,7 +4604,7 @@ class PHPMailer
*/ */
public function msgHTML($message, $basedir = '', $advanced = false) public function msgHTML($message, $basedir = '', $advanced = false)
{ {
$cid_domain = '@phpmailer.0'; $cid_domain = 'phpmailer.0';
if (filter_var($this->From, FILTER_VALIDATE_EMAIL)) { if (filter_var($this->From, FILTER_VALIDATE_EMAIL)) {
//prepend with a character to create valid RFC822 string in order to validate //prepend with a character to create valid RFC822 string in order to validate
$cid_domain = substr($this->From, strrpos($this->From, '@') + 1); $cid_domain = substr($this->From, strrpos($this->From, '@') + 1);
@ -4631,7 +4631,7 @@ class PHPMailer
} }
//Hash the decoded data, not the URL, so that the same data-URI image used in multiple places //Hash the decoded data, not the URL, so that the same data-URI image used in multiple places
//will only be embedded once, even if it used a different encoding //will only be embedded once, even if it used a different encoding
$cid = substr(hash('sha256', $data), 0, 32) . $cid_domain; //RFC2392 S 2 $cid = substr(hash('sha256', $data), 0, 32) . '@' . $cid_domain; //RFC2392 S 2
if (!$this->cidExists($cid)) { if (!$this->cidExists($cid)) {
$this->addStringEmbeddedImage( $this->addStringEmbeddedImage(
@ -4665,7 +4665,7 @@ class PHPMailer
$directory = ''; $directory = '';
} }
//RFC2392 S 2 //RFC2392 S 2
$cid = substr(hash('sha256', $url), 0, 32) . $cid_domain; $cid = substr(hash('sha256', $url), 0, 32) . '@' . $cid_domain;
if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) { if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) {
$basedir .= '/'; $basedir .= '/';
} }