|
|
|
|
@ -209,7 +209,7 @@ class PHPMailerEnhanced extends PHPMailer {
|
|
|
|
|
$link = $match[0];
|
|
|
|
|
|
|
|
|
|
//region Check the link has no protocol (http, cid, etc.) or it's “file”
|
|
|
|
|
if (preg_match('#^(?<protocol>[a-z][a-z\d+.-]*):(?<path>.+)$#i', $link, $match) === 1) {
|
|
|
|
|
if (preg_match('#^(?:(?<protocol>[a-z][a-z\d+.-]*):)?(?<path>.+)$#i', $link, $match) === 1) {
|
|
|
|
|
if (($match['protocol'] ?? '') !== 'file') {
|
|
|
|
|
return $link;
|
|
|
|
|
}
|
|
|
|
|
@ -229,11 +229,17 @@ class PHPMailerEnhanced extends PHPMailer {
|
|
|
|
|
return $link;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$path = realpath($path);
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
//region Associate a cid to the file
|
|
|
|
|
$cid = $this->cidGenerate();
|
|
|
|
|
$embeddedImages[$cid] = $path;
|
|
|
|
|
if (array_key_exists($path, $embeddedImages)) {
|
|
|
|
|
$cid = $embeddedImages[$path];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$cid = $this->cidGenerate();
|
|
|
|
|
$embeddedImages[$path] = $cid;
|
|
|
|
|
}
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
return 'cid:' . $cid;
|
|
|
|
|
@ -251,7 +257,7 @@ class PHPMailerEnhanced extends PHPMailer {
|
|
|
|
|
$this->$bodyProperty = $body;
|
|
|
|
|
//endregion
|
|
|
|
|
//region Embed the files in the mail
|
|
|
|
|
foreach ($embeddedImages as $cid => $path) {
|
|
|
|
|
foreach ($embeddedImages as $path => $cid) {
|
|
|
|
|
$this->addEmbeddedImage($path, $cid);
|
|
|
|
|
}
|
|
|
|
|
//endregion
|
|
|
|
|
|