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

    1 answer 1

    'useFileTransport' => true . Your letter is in a file in the runtime/mail folder. Change the value to false and remember to specify the correct ports for the SMTP server.

    • I have no such folder either. i.imgur.com/5NbDWSa.png need to create it? - des1roer
    • @ des1roer not, it should be created automatically - Andrey Kolomensky