Tools\Mailer\Email::addEmbeddedBlobAttachment PHP Method

addEmbeddedBlobAttachment() public method

Options: - contentDisposition
public addEmbeddedBlobAttachment ( string $content, string $filename, string | null $mimeType = null, string | null $contentId = null, array $options = [] ) : string | $this
$content string Blob data
$filename string to attach it
$mimeType string | null (leave it empty to get mimetype from $filename)
$contentId string | null (optional)
$options array Options
return string | $this $contentId or $this
    public function addEmbeddedBlobAttachment($content, $filename, $mimeType = null, $contentId = null, array $options = [])
    {
        if ($mimeType === null) {
            $ext = pathinfo($filename, PATHINFO_EXTENSION);
            $mimeType = $this->_getMimeByExtension($ext);
        }
        $filename = pathinfo($filename, PATHINFO_FILENAME) . '_' . md5($content) . '.' . pathinfo($filename, PATHINFO_EXTENSION);
        if ($contentId === null && ($cid = $this->_isEmbeddedBlobAttachment($content, $filename))) {
            return $cid;
        }
        $options['data'] = $content;
        $options['mimetype'] = $mimeType;
        $options['contentId'] = $contentId ? $contentId : str_replace('-', '', Text::uuid()) . '@' . $this->_domain;
        $file = [$filename => $options];
        $res = $this->addAttachments($file);
        if ($contentId === null) {
            return $options['contentId'];
        }
        return $res;
    }