'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@app/mail',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'email-smtp.us-west-2.amazonaws.com',
'username' => 'anu4yzgRtf3YP6Vq431QA6iqlatm',
'password' => 'erBYPWIDq/banu4yzgRtf',
'port' => '587',
'encryption' => 'tls',
],
//'useFileTransport' => true,
],
$HTML = \Yii::$app->view->render('@app/mail/remind', [
'token' => $user->password_reset_token,
'email' => $user->email,
'url' => $url
]);
Yii::$app->mailer->compose()
->setFrom('ОТ кого')
->setTo('Кому')
->setSubject('Тема')
->setHtmlBody( $HTML )
->send();
Тоже самое только шаблон указан в compose('contact/html')
Yii::$app->mailer->compose('contact/html')
->setFrom('from@domain.com')
->setTo($form->email)
->setSubject($form->subject)
->send();
https://github.com/yiisoft/yii2-swiftmailer