src/Mail/FileTransport.php
public function send(\Zend\Mail\Message $message)
    {
        $options  = $this->options;
        $filename = call_user_func($options->getCallback(), $this);
        $file     = $options->getPath() . DIRECTORY_SEPARATOR . $filename;


        $contents = $message->toString();
        $umask = umask();
        umask(022);
        if (false === file_put_contents($file, $contents, LOCK_EX)) {
            throw new RuntimeException(sprintf(
                'Unable to write mail to file (directory "%s")',
                $options->getPath()
            ));
        }
        umask($umask);
        $this->lastFile = $file;
    }
public function send(\Zend\Mail\Message $message)
    {
        $options  = $this->options;
        $filename = call_user_func($options->getCallback(), $this);
        $file     = $options->getPath() . DIRECTORY_SEPARATOR . $filename;


        $contents = $message->toString();
        $umask = umask();
        umask(022);
        if (false === file_put_contents($file, $contents, LOCK_EX)) {
            throw new RuntimeException(sprintf(
                'Unable to write mail to file (directory "%s")',
                $options->getPath()
            ));
        }
        umask($umask);
        $this->lastFile = $file;
    }
public function send ( \ Zend \ Mail \ Message $ message ) { $ options = $ this -> options ; $ filename = call_user_func ( $ options -> getCallback ( ) , $ this ) ; $ file = $ options -> getPath ( ) . DIRECTORY_SEPARATOR . $ filename ; $ contents = $ message -> toString ( ) ; $ umask = umask ( ) ; umask ( 022 ) ; if ( false === file_put_contents ( $ file , $ contents , LOCK_EX ) ) { throw new RuntimeException ( sprintf ( 'Unable to write mail to file (directory "%s")' , $ options -> getPath ( ) ) ) ; } umask ( $ umask ) ; $ this -> lastFile = $ file ; }
Saves e-mail message to a file

@param \Zend\Mail\Message $message
@throws RuntimeException on not writable target directory or
on file_put_contents() failure
Saves e - mail message to a file