I can\'t finally understand how to use the swiftMailer extension in Yii2. Judging by that on this subject I didn\'t find questions, the task is trivial, but up to the end I
Actually, you have to use config key mailer instead of mail.
'components' => [
...
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'localhost',
'username' => 'username',
'password' => 'password',
'port' => '587',
'encryption' => 'tls',
],
],
...
],