core/components/Mail.php
public function addAttachment($filePath, $name = null)
    {
        $this->getMailer()->addAttachment($filePath, empty($name) ? pathinfo($filePath, PATHINFO_BASENAME) : $name);
        
        return $this;
    }
public function addAttachment($filePath, $name = null)
    {
        $this->getMailer()->addAttachment($filePath, empty($name) ? pathinfo($filePath, PATHINFO_BASENAME) : $name);
        
        return $this;
    }
public function addAttachment ( $ filePath , $ name = null ) { $ this -> getMailer ( ) -> addAttachment ( $ filePath , empty ( $ name ) ? pathinfo ( $ filePath , PATHINFO_BASENAME ) : $ name ) ; return $ this ; }
Add attachment.

@param string $filePath The path to the file, will be checked with `is_file`.
@param string $name An optional name to use for the Attachment.
@return \luya\components\Mail
Add attachment .