2017-10-14 117 views
0

我正在使用yii2高级版。我想要联系表格发送电子邮件给管理员。但它不工作应该做什么?我在下面的方式试图=>如何从联系页面获取邮件yii2高级版

'adminEmail' => '[email protected]', //wrote admin email id here 

也改变
'useFileTransport' => false, 什么具体步骤以激活它可以在任何一个解决这个问题?

回答

3

在你的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' => '[email protected]', 
      'password' => 'your_gmail_password', 
      'port' => '587', 
      'encryption' => 'tls', 
     ], 
+0

哎...谢谢...现在是工作,你可以使用...我只是Gmail帐户设置==>允许安全性较低的应用程序:ON – Goli

+0

在邮件中,我得到主题和正文...如何获取姓名和电子邮件ID字段?数据库在哪里? – Goli

+0

找不到用户的电子邮件ID填写联系我们形式 – Goli

相关问题