Skip to content

Commit 51d6963

Browse files
committed
fix: setAttachmentCID() does not work with buffer string
1 parent 1741648 commit 51d6963

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

system/Email/Email.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,13 +705,23 @@ public function attach($file, $disposition = '', $newname = null, $mime = '')
705705
public function setAttachmentCID($filename)
706706
{
707707
foreach ($this->attachments as $i => $attachment) {
708+
// For file path.
708709
if ($attachment['name'][0] === $filename) {
709710
$this->attachments[$i]['multipart'] = 'related';
710711

711712
$this->attachments[$i]['cid'] = uniqid(basename($attachment['name'][0]) . '@', true);
712713

713714
return $this->attachments[$i]['cid'];
714715
}
716+
717+
// For buffer string.
718+
if ($attachment['name'][1] === $filename) {
719+
$this->attachments[$i]['multipart'] = 'related';
720+
721+
$this->attachments[$i]['cid'] = uniqid(basename($attachment['name'][1]) . '@', true);
722+
723+
return $this->attachments[$i]['cid'];
724+
}
715725
}
716726

717727
return false;

0 commit comments

Comments
 (0)