symfony / swiftmailer-bundle

Symfony Swiftmailer Bundle
https://symfony.com/swiftmailer-bundle
MIT License
1.56k stars 151 forks source link

Attempted to load class "Swift_Transport_Esmtp_Auth_CramMd5Authenticator" from the global namespace #243

Closed qlerebours closed 4 years ago

qlerebours commented 6 years ago

Hello !

i'm trying to send a mail with Symfony in a controller. Here is my code:

public function testSendMailAction() {
        $mailer = $this->container->get('mailer');

        $message = (new \Swift_Message('Hello Email'))
            ->setFrom('an.email@gmail.com')
            ->setTo('another.email@gmail.com')
            ->setBody('You should see me from the profiler!')
        ;

        $mailer->send($message);

        return new JsonResponse("Tried to send mail");
    }

The configuration:

    parameters:
        mailer_transport: gmail
        mailer_user: xxxxxxx@gmail.com
        mailer_password:   'mypassword'

    swiftmailer:
        transport: "%mailer_transport%"
        username:  "%mailer_user%"
        password:  "%mailer_password%"
        spool: { type: memory }

The error i get:

image

My composer.json:

    "symfony/symfony": "3.4.*",
    "symfony/swiftmailer-bundle": "^3.2",

Can anyone help me please ?

qlerebours commented 6 years ago

I downgraded to 2.3 and it worked

xzessmedia commented 5 years ago

omg, downgrade is not a solution. can somebody involved please answer to this issue with a correct solution for the latest version? its open since 1 year......