public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
    try {
      if ( !@is_file($path) ) {
        throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
      }
      $filename = basename($path);
      if ( $name == '' ) {
        $name = $filename;
      }

      $this->attachment[] = array(
        0 => $path,
        1 => $filename,
        2 => $name,
        3 => $encoding,
        4 => $type,
        5 => false,  // isStringAttachment
        6 => 'attachment',
        7 => 0
      );

    } catch (phpmailerException $e) {
      $this->SetError($e->getMessage());
      if ($this->exceptions) {
        throw $e;
      }
      echo $e->getMessage()."\n";
      if ( $e->getCode() == self::STOP_CRITICAL ) {
        return false;
      }
    }
    return true;
  }
public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
    try {
      if ( !@is_file($path) ) {
        throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
      }
      $filename = basename($path);
      if ( $name == '' ) {
        $name = $filename;
      }

      $this->attachment[] = array(
        0 => $path,
        1 => $filename,
        2 => $name,
        3 => $encoding,
        4 => $type,
        5 => false,  // isStringAttachment
        6 => 'attachment',
        7 => 0
      );

    } catch (phpmailerException $e) {
      $this->SetError($e->getMessage());
      if ($this->exceptions) {
        throw $e;
      }
      echo $e->getMessage()."\n";
      if ( $e->getCode() == self::STOP_CRITICAL ) {
        return false;
      }
    }
    return true;
  }
public function AddAttachment ( $ path , $ name = '' , $ encoding = 'base64' , $ type = 'application/octet-stream' ) { try { if ( ! @ is_file ( $ path ) ) { throw new phpmailerException ( $ this -> Lang ( 'file_access' ) . $ path , self :: STOP_CONTINUE ) ; } $ filename = basename ( $ path ) ; if ( $ name == '' ) { $ name = $ filename ; } $ this -> attachment [ ] = array ( 0 => $ path , 1 => $ filename , 2 => $ name , 3 => $ encoding , 4 => $ type , 5 => false , // isStringAttachment 6 => 'attachment' , 7 => 0 ) ; } catch ( phpmailerException $ e ) { $ this -> SetError ( $ e -> getMessage ( ) ) ; if ( $ this -> exceptions ) { throw $ e ; } echo $ e -> getMessage ( ) . "\n" ; if ( $ e -> getCode ( ) == self :: STOP_CRITICAL ) { return false ; } } return true ; }
Adds an attachment from a path on the filesystem.
Returns false if the file could not be found
or accessed.
@param string $path Path to the attachment.
@param string $name Overrides the attachment name.
@param string $encoding File encoding (see $Encoding).
@param string $type File extension (MIME) type.
@return bool
Adds an attachment from a path on the filesystem . Returns false if the file could not be found or accessed .