错误:“调用未定义的方法ping。”使用Yii2和Swiftmailer

Any help would be highly appreciated.

I do not understand what I am doing wrong. I have used Swiftmailer before and it has never been this difficult to configure it.

I am using an advanced Yii2 project.

This is part of my backend/config/main.php (I have tried with backend/config/main-local.php, common/config/main.php and common/config/main-local.php just in case):

....
 'components' => [
 'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => false,
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'localhost',
                'username' => 'name@example.com',
                'password' => 'password',
                'port' => '587',
                'encryption' => 'tls',
                'plugins' => [
                    [
                        'class' => 'Swift_Plugins_ThrottlerPlugin',
                        'constructArgs' => [20],
                    ],
                ],
            ],
        ],
....
],

This is part of my controller:

 public function actionTests()
    {  
    Yii::$app->mailer->compose()
            ->setFrom('name@example.com')
            ->setTo('name_2@example.com')
            ->setSubject('Email sent from Yii2-Swiftmailer')
            ->send();
    }

This is the error I am getting: enter image description here

enter image description here