In your controller
Yii::$app->mail->compose()->setFrom('yyy@gmail.com')->setTo('sss@gmail.com')->setSubject('Email sent from Yii2-Swiftmailer')->send();
In common/config/main-local.php
In components array
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com', // e.g. smtp.mandrillapp.com or smtp.gmail.com
'username' => 'ttt@gmail.com',
'password' => 'ggg',
'port' => '587', // Port 25 is a very common port too
'encryption' => 'tls', // It is often used, check your provider or mail server specs
],
],
Yii::$app->mail->compose()->setFrom('yyy@gmail.com')->setTo('sss@gmail.com')->setSubject('Email sent from Yii2-Swiftmailer')->send();
In common/config/main-local.php
In components array
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com', // e.g. smtp.mandrillapp.com or smtp.gmail.com
'username' => 'ttt@gmail.com',
'password' => 'ggg',
'port' => '587', // Port 25 is a very common port too
'encryption' => 'tls', // It is often used, check your provider or mail server specs
],
],
No comments:
Post a Comment