code: protected function spoolMessage($to, $subject, $message, $additional_headers = '', $additional_parameters = '')
      {
          if (empty($this->spool_dir)) {
              throw new \Exception('You must define a spool directory to spool emails!');
          }
          $contents = array(
              'to'=>$to,
              'subject'=>$subject,
              'message'=>$message,
              'additional_headers'=>$additional_headers,
              'additional_parameters'=>$additional_parameters
          );
          return $this->getSpooler()
              ->setSpoolDirectory($this->spool_dir)
              ->addMessageToSpool($this->getMessage()->getId(), $contents, false);
      }
docs: Messages spooler : prepare the whole content and write it in a file
  
  @param string $to
  @param string $subject
  @param string $message
  @param string $additional_headers
  @param string $additional_parameters
  @return mixed
  @throws \Exception if `spool_dir` is not defined