public function setAttachments($files)
    {
        // Always erase
        $this->_attachments = array();

        // check if we have an input value
        if ($files == null) {
            return;
        }

        // make sure we are dealing with an array
        if (!is_array($files)) {
            $files = array($files);
        }

        // Append each attachment one by one in order
        // to normalize each input
        foreach ($files as $key => $file) {
            if (is_numeric($key)) {
                // key is numeric, assume keyed array or string
                $this->appendAttachment($file);
            } else {
                // key is not numeric, assume key is filename
                // and file is a string, key needs to be preserved
                $this->appendAttachment(array($key => $file));
            }
        }
    }
public function setAttachments($files)
    {
        // Always erase
        $this->_attachments = array();

        // check if we have an input value
        if ($files == null) {
            return;
        }

        // make sure we are dealing with an array
        if (!is_array($files)) {
            $files = array($files);
        }

        // Append each attachment one by one in order
        // to normalize each input
        foreach ($files as $key => $file) {
            if (is_numeric($key)) {
                // key is numeric, assume keyed array or string
                $this->appendAttachment($file);
            } else {
                // key is not numeric, assume key is filename
                // and file is a string, key needs to be preserved
                $this->appendAttachment(array($key => $file));
            }
        }
    }
public function setAttachments ( $ files ) { // Always erase $ this -> _attachments = array ( ) ; // check if we have an input value if ( $ files == null ) { return ; } // make sure we are dealing with an array if ( ! is_array ( $ files ) ) { $ files = array ( $ files ) ; } // Append each attachment one by one in order // to normalize each input foreach ( $ files as $ key => $ file ) { if ( is_numeric ( $ key ) ) { // key is numeric, assume keyed array or string $ this -> appendAttachment ( $ file ) ; } else { // key is not numeric, assume key is filename // and file is a string, key needs to be preserved $ this -> appendAttachment ( array ( $ key => $ file ) ) ; } } }
This function sets one or multiple attachment files
to the email.

Passing `null` to this function will
erase the current values with an empty array.

@param string|array $files
Accepts the same parameters format as `EmailGateway::addAttachment()`
but you can also all multiple values at once if all files are
wrap in a array.

Example:
````
$email->setAttachments(array(
array(
'file' => 'http://example.com/foo.txt',
'charset' => 'UTF-8'
),
'path/to/your/webspace/foo/bar.csv',
...
));
````
This function sets one or multiple attachment files to the email .