The controller for URI "/register" is not callable mailer DSN must contain a scheme

I am trying to use mailer with symfony but i got this error :

The controller for URI "/register" is not callable: The "MAILER_DSN=smtp://lionel:[email protected]@gmail.com:465" mailer DSN must contain a scheme.

I tried to follow the documentation.

    <?php

namespace AppController;

use AppEntityProspect;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentMailerMailerInterface;
use SymfonyComponentMimeEmail;
use SymfonyComponentRoutingAnnotationRoute;

class MailerController extends AbstractController

{
    /**
     * @Route("/email")
     */
    public function index(MailerInterface $mailer, Prospect $prospect)
    {
        $email = (new Email())
            ->from('[email protected]')
            ->to($prospect->getEmail())
            //->cc('[email protected]')
            //->bcc('[email protected]')
            //->replyTo('[email protected]')
            //->priority(Email::PRIORITY_HIGH)
            ->subject('Time for Symfony Mailer!')
            ->text('Sending emails is fun again!')
            ->html('<p>See Twig integration for better HTML integration!</p>');

        $mailer->send($email);
    }
}

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *