function addAttachment($file,
        $c_type      = 'application/octet-stream',
        $name        = '',
        $isfile      = true,
        $encoding    = 'base64',
        $disposition = 'attachment',
        $charset     = '',
        $language    = '',
        $location    = '',
        $n_encoding  = null,
        $f_encoding  = null,
        $description = '',
        $h_charset   = null,
        $add_headers = array()
    ) {
        $bodyfile = null;

        if ($isfile) {
            // Don't load file into memory
            if ($this->_build_params['delay_file_io']) {
                $filedata = null;
                $bodyfile = $file;
            } else {
                if ($this->_isError($filedata = $this->_file2str($file))) {
                    return $filedata;
                }
            }
            // Force the name the user supplied, otherwise use $file
            $filename = ($name ? $name : $this->_basename($file));
        } else {
            $filedata = $file;
            $filename = $name;
        }

        if (!strlen($filename)) {
            $msg = "The supplied filename for the attachment can't be empty";
            return $this->_raiseError($msg);
        }

        $this->_parts[] = array(
            'body'        => $filedata,
            'body_file'   => $bodyfile,
            'name'        => $filename,
            'c_type'      => $c_type,
            'charset'     => $charset,
            'encoding'    => $encoding,
            'language'    => $language,
            'location'    => $location,
            'disposition' => $disposition,
            'description' => $description,
            'add_headers' => $add_headers,
            'name_encoding'     => $n_encoding,
            'filename_encoding' => $f_encoding,
            'headers_charset'   => $h_charset,
        );

        return true;
    }
function addAttachment($file,
        $c_type      = 'application/octet-stream',
        $name        = '',
        $isfile      = true,
        $encoding    = 'base64',
        $disposition = 'attachment',
        $charset     = '',
        $language    = '',
        $location    = '',
        $n_encoding  = null,
        $f_encoding  = null,
        $description = '',
        $h_charset   = null,
        $add_headers = array()
    ) {
        $bodyfile = null;

        if ($isfile) {
            // Don't load file into memory
            if ($this->_build_params['delay_file_io']) {
                $filedata = null;
                $bodyfile = $file;
            } else {
                if ($this->_isError($filedata = $this->_file2str($file))) {
                    return $filedata;
                }
            }
            // Force the name the user supplied, otherwise use $file
            $filename = ($name ? $name : $this->_basename($file));
        } else {
            $filedata = $file;
            $filename = $name;
        }

        if (!strlen($filename)) {
            $msg = "The supplied filename for the attachment can't be empty";
            return $this->_raiseError($msg);
        }

        $this->_parts[] = array(
            'body'        => $filedata,
            'body_file'   => $bodyfile,
            'name'        => $filename,
            'c_type'      => $c_type,
            'charset'     => $charset,
            'encoding'    => $encoding,
            'language'    => $language,
            'location'    => $location,
            'disposition' => $disposition,
            'description' => $description,
            'add_headers' => $add_headers,
            'name_encoding'     => $n_encoding,
            'filename_encoding' => $f_encoding,
            'headers_charset'   => $h_charset,
        );

        return true;
    }
function addAttachment ( $ file , $ c_type = 'application/octet-stream' , $ name = '' , $ isfile = true , $ encoding = 'base64' , $ disposition = 'attachment' , $ charset = '' , $ language = '' , $ location = '' , $ n_encoding = null , $ f_encoding = null , $ description = '' , $ h_charset = null , $ add_headers = array ( ) ) { $ bodyfile = null ; if ( $ isfile ) { // Don't load file into memory if ( $ this -> _build_params [ 'delay_file_io' ] ) { $ filedata = null ; $ bodyfile = $ file ; } else { if ( $ this -> _isError ( $ filedata = $ this -> _file2str ( $ file ) ) ) { return $ filedata ; } } // Force the name the user supplied, otherwise use $file $ filename = ( $ name ? $ name : $ this -> _basename ( $ file ) ) ; } else { $ filedata = $ file ; $ filename = $ name ; } if ( ! strlen ( $ filename ) ) { $ msg = "The supplied filename for the attachment can't be empty" ; return $ this -> _raiseError ( $ msg ) ; } $ this -> _parts [ ] = array ( 'body' => $ filedata , 'body_file' => $ bodyfile , 'name' => $ filename , 'c_type' => $ c_type , 'charset' => $ charset , 'encoding' => $ encoding , 'language' => $ language , 'location' => $ location , 'disposition' => $ disposition , 'description' => $ description , 'add_headers' => $ add_headers , 'name_encoding' => $ n_encoding , 'filename_encoding' => $ f_encoding , 'headers_charset' => $ h_charset , ) ; return true ; }
Adds a file to the list of attachments.

@param string $file        The file name of the file to attach
or the file contents itself
@param string $c_type      The content type
@param string $name        The filename of the attachment
Only use if $file is the contents
@param bool   $isfile      Whether $file is a filename or not. Defaults to true
@param string $encoding    The type of encoding to use. Defaults to base64.
Possible values: 7bit, 8bit, base64 or quoted-printable.
@param string $disposition The content-disposition of this file
Defaults to attachment.
Possible values: attachment, inline.
@param string $charset     The character set of attachment's content.
@param string $language    The language of the attachment
@param string $location    The RFC 2557.4 location of the attachment
@param string $n_encoding  Encoding of the attachment's name in Content-Type
By default filenames are encoded using RFC2231 method
Here you can set RFC2047 encoding (quoted-printable
or base64) instead
@param string $f_encoding  Encoding of the attachment's filename
in Content-Disposition header.
@param string $description Content-Description header
@param string $h_charset   The character set of the headers e.g. filename
If not specified, $charset will be used
@param array  $add_headers Additional part headers. Array keys can be in form
of <header_name>:<parameter_name>

@return mixed              True on success or PEAR_Error object
@access public
Adds a file to the list of attachments .