lib/classes/Swift/Mime/Attachment.php
public function setFile(Swift_FileStream $file, $contentType = null)
    {
        $this->setFilename(basename($file->getPath()));
        $this->setBody($file, $contentType);
        if (!isset($contentType)) {
            $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));

            if (array_key_exists($extension, $this->mimeTypes)) {
                $this->setContentType($this->mimeTypes[$extension]);
            }
        }

        return $this;
    }
public function setFile(Swift_FileStream $file, $contentType = null)
    {
        $this->setFilename(basename($file->getPath()));
        $this->setBody($file, $contentType);
        if (!isset($contentType)) {
            $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));

            if (array_key_exists($extension, $this->mimeTypes)) {
                $this->setContentType($this->mimeTypes[$extension]);
            }
        }

        return $this;
    }
public function setFile ( Swift_FileStream $ file , $ contentType = null ) { $ this -> setFilename ( basename ( $ file -> getPath ( ) ) ) ; $ this -> setBody ( $ file , $ contentType ) ; if ( ! isset ( $ contentType ) ) { $ extension = strtolower ( substr ( $ file -> getPath ( ) , strrpos ( $ file -> getPath ( ) , '.' ) + 1 ) ) ; if ( array_key_exists ( $ extension , $ this -> mimeTypes ) ) { $ this -> setContentType ( $ this -> mimeTypes [ $ extension ] ) ; } } return $ this ; }
Set the file that this attachment is for.

@param string $contentType optional

@return $this
Set the file that this attachment is for .