user3703456
user3703456

Reputation:

Symfony / SwiftMailer / Can't send email without spool

I have a problem with email sending. I can't send email without spool. In documentation I see just $mailer->send(); http://symfony.com/doc/current/email.html

But for me, it does nothing. To send email, I have to do this:

            $mailer->send($message);
            $spool = $mailer->getTransport()->getSpool();
            $transport = $this->get('swiftmailer.transport.real');
            $spool->flushQueue($transport);

ContactType.php

    $builder
        ->add('name', TextType::class, [
            'required' => false
        ])
        ->add('email', EmailType::class)
        ->add('message', TextareaType::class);

Where can be a problem?

Upvotes: 0

Views: 691

Answers (1)

mblaettermann
mblaettermann

Reputation: 1943

You could define an non-spooled mailer and use that instead of the default one:

https://symfony.com/doc/current/reference/configuration/swiftmailer.html#using-multiple-mailers

Upvotes: 1

Related Questions