Tuesday, April 21, 2015

Enable email sending or useFileTransport in yii2

In yii2 contact us, if you are seeing this message
Note that if you turn on the Yii debugger, you should be able to view the mail message on the mail panel of the debugger. Because the application is in development mode, the email is not sent but saved as a file under C:\UniServerZ\www\runtime/mail. Please configure the useFileTransport property of the mail application component to be false to enable email sending. 
the solution here is simple, just open
/yii2/config/web.php
and find the word useFileTransport and set it to false
  'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => false,
        ],
note: your previous email that was not sent can be found in yii2\runtime\mail