yiisoft/yii2-symfonymailer

Failed to instantiate component or class "yii\symfonymailer\Mailer::class".

metola opened this issue · 6 comments

Hi, If I add :: class show the error:
Failed to instantiate component or class "yii\symfonymailer\Mailer::class".

but if I not use ::class work well
'class' => 'yii\symfonymailer\Mailer',

I belive that is need change in Readme.

By the way, I change from 'yii\swiftmailer\Mailer' to 'yii\symfonymailer\Mailer' and for the moment all work well, this is my changes:
With Swiftmailer;

	'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => false,
            'transport' =>
                [
                    'class' => 'Swift_SmtpTransport',
                    'host' => 'email-smtp.eu-west-1.amazonaws.com',
                    'username' => '****',
                    'password' => '****',
                    'port' => '587',
                    'encryption' => 'tls',
                ]
        ],

and with Symfony:

'mailer' => [
            'class' => 'yii\symfonymailer\Mailer',
            'transport' =>
                [
                    'dsn' => 'ses+smtp://USERNAME:PASSWORD@email-smtp.eu-west-1.amazonaws.com',
                ]
        ],		

When you add ::class do you remove quotes around the name?

'mailer' => [
    'class' => yii\swiftmailer\Mailer::class,

I´m idiot , yes it is.

c7v commented

Не помогло, у меня PhpStorm подсказывает что класса вообще нет.

Не помогло, у меня PhpStorm подсказывает что класса вообще нет.

Did you run composer install?

Also, note the missing slash \ in front of yii in previous comments (that had ::class), maybe try:

'class' => \yii\symfonymailer\Mailer::class,

c7v commented

Did you run composer install?

On the same day I noticed that the class was not installed. @samdark Александр, а разве этот класс не устанавливается сразу при развёртывании Yii2 Advance?