There is a built-in swiftmailer but I still feel that it's game.
in \ config \ web.php
'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', // 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' => true, 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => '*****', // eg smtp.mandrillapp.com or smtp.gmail.com 'username' => '', 'password' => '', 'port' => 25, // Port 25 is a very common port too // 'encryption' => 'tls', // It is often used, check your provider or mail server specs ], ],
trying to send views \ site \ index.php
use yii\swiftmailer\Mailer; /* @var $this yii\web\View */ $this->title = 'My Yii Application'; Yii::$app->mailer->compose() ->setFrom('from@domain.com') ->setTo('***@gmail.com') ->setSubject('dsfdfsdf') ->send();
no mistakes, no letters