Yii2 密码重置不起作用

Yii2 password reset does not work

我使用 Windows 和 Yii 2.0.13.1,xampp 与 php7.1.4。 登录时,我单击 重置 link 并输入我的电子邮件并发送,我遇到此错误:

Swift_TransportException
Process could not be started [The system cannot find the path specified. ]

我的common/config/main-local.php是:

'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        'viewPath' => '@common/mail',
        // 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,
],

其他设置和文件都是默认模式。 问题是什么?请指导我

您的配置中似乎缺少传输配置
例如:使用 gmail.com 作为传输(您应该选择主机可用的传输)

    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        'viewPath' => '@common/mail',
        'useFileTransport' => false,//set this property to false to send mails to real email addresses

        'transport' => [
            'class' => 'Swift_SmtpTransport',
            'host' => 'smtp.gmail.com',
            'username' => 'yourmail@gmail.com',
            'password' => 'your_password',
            'port' => '587',
            'encryption' => 'tls',
            'streamOptions' => [
                'ssl' => [
                    'verify_peer' => false,
                    'allow_self_signed' => true
                ],
            ]
        ],

    ],

一切就绪