concrete/src/Mail/Service.php
public function addAttachmentWithHeaders(File $file, array $headers)
    {
        $fileVersion = $file->getVersion();
        $resource = $fileVersion->getFileResource();
        if (array_key_exists('filename', $headers)) {
            $filename = $headers['filename'];
            unset($headers['filename']);
        } else {
            $filename = $fileVersion->getFilename();
        }
        if (!array_key_exists('mimetype', $headers)) {
            $headers['mimetype'] = $resource->getMimetype();
        }
        $this->addRawAttachmentWithHeaders(
            $resource->read(),
            $filename,
            $headers
        );
    }
public function addAttachmentWithHeaders(File $file, array $headers)
    {
        $fileVersion = $file->getVersion();
        $resource = $fileVersion->getFileResource();
        if (array_key_exists('filename', $headers)) {
            $filename = $headers['filename'];
            unset($headers['filename']);
        } else {
            $filename = $fileVersion->getFilename();
        }
        if (!array_key_exists('mimetype', $headers)) {
            $headers['mimetype'] = $resource->getMimetype();
        }
        $this->addRawAttachmentWithHeaders(
            $resource->read(),
            $filename,
            $headers
        );
    }
public function addAttachmentWithHeaders ( File $ file , array $ headers ) { $ fileVersion = $ file -> getVersion ( ) ; $ resource = $ fileVersion -> getFileResource ( ) ; if ( array_key_exists ( 'filename' , $ headers ) ) { $ filename = $ headers [ 'filename' ] ; unset ( $ headers [ 'filename' ] ) ; } else { $ filename = $ fileVersion -> getFilename ( ) ; } if ( ! array_key_exists ( 'mimetype' , $ headers ) ) { $ headers [ 'mimetype' ] = $ resource -> getMimetype ( ) ; } $ this -> addRawAttachmentWithHeaders ( $ resource -> read ( ) , $ filename , $ headers ) ; }
Add a File entity as an attachment of the message, specifying the headers of the mail MIME part.

@param File $file The file to attach to the message
@param array $headers Additional headers fo the MIME part. Valid values are:
- filename: The name to give to the attachment (it will be used as the filename part of the Content-Disposition header) [default: the filename of the File instance]
- mimetype: the main value of the Content-Type header [default: the content type of the file]
- disposition: the main value of the Content-Disposition header [default: attachment]
- encoding: the value of the Content-Transfer-Encoding header [default: base64]
- charset: the charset value of the Content-Type header
- boundary: the boundary value of the Content-Type header
- id: the value of the Content-ID header (without angular brackets)
- description: the value of the Content-Description header
- location: the value of the Content-Location header
- language: the value of the Content-Language header
Add a File entity as an attachment of the message specifying the headers of the mail MIME part .