Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
metola opened this issue Dec 29, 2021 · 6 comments
Closed

Comments

@metola
Copy link

metola commented Dec 29, 2021

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',
                ]
        ],		
@samdark samdark added status:to be verified Needs to be reproduced and validated. and removed status:to be verified Needs to be reproduced and validated. labels Dec 29, 2021
@samdark
Copy link
Member

samdark commented Dec 29, 2021

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

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

@metola
Copy link
Author

metola commented Dec 29, 2021

I´m idiot , yes it is.

@metola metola closed this as completed Dec 29, 2021
@c7v
Copy link

c7v commented Dec 19, 2022

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

@Swanty
Copy link
Contributor

Swanty commented Dec 19, 2022

Не помогло, у меня 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
Copy link

c7v commented Dec 21, 2022

Did you run composer install?

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

@samdark
Copy link
Member

samdark commented Feb 19, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants