Swiftmailer in Yii2 - Unable to send email -
i'm using basic yii2 template , swiftmailer send email..
here code config/web.php
:
'mailer' => [ 'class' => 'yii\swiftmailer\mailer', // send mails file default. have set // 'usefiletransport' false , configure transport // mailer send real emails. 'usefiletransport'=>'false', 'transport' => [ 'class' => 'swift_smtptransport', 'host' => 'smtp.gmail.com', 'username' => 'myemail@gmail.com', 'password' => 'password', 'port' => '587', 'encryption' => 'tls', ], ],
and controller code is:
$fname = yii::$app->request->post('fname'); $email = yii::$app->request->post('email'); $industry = yii::$app->request->post('industry'); $info = yii::$app->request->post('info'); $mail = yii::$app->mailer->compose() ->setfrom('myemail@gmail.com') ->setto($email) ->setsubject('test mail') ->settextbody($info) ->send();
i'm getting email logs, no email being send...
thanks.
in order keep account less vulnerable, google has introduced policy. login through our account without creating app on google, google ask our permission ensure security of our account.
access below url fix problem , select "turn on" https://www.google.com/settings/security/lesssecureapps
Comments
Post a Comment