original_string: public function attachFile($file, $type, $name = null, $asstring = false)
      {
          $content = $asstring ? $file : file_get_contents($file);
          if (!$content) {
              throw new Exception_TMail('Error reading attachment: '.($asstring ? $name : $file));
          }
          if (is_null($name)) {
              if ($asstring) {
                  $name = 'file_'.count($this->mime);
              } else {
                  $name = basename($file);
              }
          }
          // encoding content
          $this->mime['"'.$name.'"'] = array(
                  'type' => $type,
                  'content' => base64_encode($content),
                  'attachment' => true,
                  );
  
          return $this;
      }
code: public function attachFile($file, $type, $name = null, $asstring = false)
      {
          $content = $asstring ? $file : file_get_contents($file);
          if (!$content) {
              throw new Exception_TMail('Error reading attachment: '.($asstring ? $name : $file));
          }
          if (is_null($name)) {
              if ($asstring) {
                  $name = 'file_'.count($this->mime);
              } else {
                  $name = basename($file);
              }
          }
          // encoding content
          $this->mime['"'.$name.'"'] = array(
                  'type' => $type,
                  'content' => base64_encode($content),
                  'attachment' => true,
                  );
  
          return $this;
      }
code_tokens: public function attachFile ( $ file , $ type , $ name = null , $ asstring = false ) { $ content = $ asstring ? $ file : file_get_contents ( $ file ) ; if ( ! $ content ) { throw new Exception_TMail ( 'Error reading attachment: ' . ( $ asstring ? $ name : $ file ) ) ; } if ( is_null ( $ name ) ) { if ( $ asstring ) { $ name = 'file_' . count ( $ this -> mime ) ; } else { $ name = basename ( $ file ) ; } } // encoding content $ this -> mime [ '"' . $ name . '"' ] = array ( 'type' => $ type , 'content' => base64_encode ( $ content ) , 'attachment' => true , ) ; return $ this ; }
docstring: Attaches a saved file.
  
  @param $file any valid path to a file
  @param $type valid mime type. e.g.:
  audio/mpeg
  image/jpeg
  application/zip
  audio/wav
  etc.
  @param $name optional, sets the filename for message
  @param $asstring if set to true, $file contains contents, not filename
docstring_tokens: Attaches a saved file .