yii2 advanced如何从联系页面获取邮件

how to get mail from contact page yii2 advanced

我正在使用 yii2 advance。我希望联系表格向管理员发送电子邮件。但它不工作应该怎么办?我尝试了以下方式=>

'adminEmail' => 'admin@example.com', //wrote admin email id here

也有变化
'useFileTransport' => false, 激活它的确切步骤是什么,有人可以解决这个问题吗?

在您的 config.php 中,您还应该配置适当的传输,例如,对于基于 gmail 帐户的传输,您可以使用

    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        .....
        'useFileTransport' => false,//set this property to false to send mails to real email addresses
        //comment the following array to send mail using php's mail function
        //
        //
        /* configurazione servizio email da usare in locale (localhost sviluppo) */
        'transport' => [
            'class' => 'Swift_SmtpTransport',
            'host' => 'smtp.gmail.com',
            'username' => 'your_gmail_username@gmail.com',
            'password' => 'your_gmail_password',
            'port' => '587',
            'encryption' => 'tls',
        ],