Laravel mail pretend prints nothing

后端 未结 5 444
走了就别回头了
走了就别回头了 2021-02-01 16:48

I set \'pretend\' => true, in the mail.php, created this new.php view:


    
E-mail: {{
5条回答
  •  一向
    一向 (楼主)
    2021-02-01 17:17

    This is the normal behaviour of pretend in the Laravel Mailer system. It will not render your message anywhere, not even in the log, it will just log that a mail message was pretended to be sent. Look at the related source code:

    /**
     * Send a Swift Message instance.
     *
     * @param  Swift_Message  $message
     * @return void
     */
    protected function sendSwiftMessage($message)
    {
        if ( ! $this->pretending)
        {
            return $this->swift->send($message);
        }
        elseif (isset($this->logger))
        {
            $this->logMessage($message);
        }
    }
    
    /**
     * Log that a message was sent.
     *
     * @param  Swift_Message  $message
     * @return void
     */
    protected function logMessage($message)
    {
        $emails = implode(', ', array_keys($message->getTo()));
    
        $this->logger->info("Pretending to mail message to: {$emails}");
    }
    

提交回复
热议问题