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
        );
    }