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
        );
    }
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
        );
    }
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 ) ; }
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
Convert a mail object to json and store it at mail folder path