original_string: public function saveMail($mail)
      {
          // first save file to spool path
          // to avoid exceptions on external storage provider connection
  
          // convert message to json
          $mailJson = json_encode($mail);
  
          $this->createFolder(
              $this->getMailFolderPathById($mail->getId())
          );
  
          // try to store message to filesystem
          return $this->storeFile(
              $mailJson,
              $this->getMailFolderPathById($mail->getId()) .
                  DIRECTORY_SEPARATOR . self::MAIL_FILE_NAME
          );
      }
code: public function saveMail($mail)
      {
          // first save file to spool path
          // to avoid exceptions on external storage provider connection
  
          // convert message to json
          $mailJson = json_encode($mail);
  
          $this->createFolder(
              $this->getMailFolderPathById($mail->getId())
          );
  
          // try to store message to filesystem
          return $this->storeFile(
              $mailJson,
              $this->getMailFolderPathById($mail->getId()) .
                  DIRECTORY_SEPARATOR . self::MAIL_FILE_NAME
          );
      }
code_tokens: public function saveMail ( $ mail ) { // first save file to spool path // to avoid exceptions on external storage provider connection // convert message to json $ mailJson = json_encode ( $ mail ) ; $ this -> createFolder ( $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) ) ; // try to store message to filesystem return $ this -> storeFile ( $ mailJson , $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . DIRECTORY_SEPARATOR . self :: MAIL_FILE_NAME ) ; }
docstring: Convert a mail object to json and store it at mail folder path
  
  @param \Shockwavemk\Mail\Base\Model\Mail $mail
  @return bool
  @throws \Magento\Framework\Exception\FileSystemException
  @throws \Exception
docstring_tokens: Convert a mail object to json and store it at mail folder path