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

  controller, email, mailer, symfony

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]" mailer DSN must contain a scheme.

I tried to follow the documentation.


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]')
            //->cc('[email protected]')
            //->bcc('[email protected]')
            //->replyTo('[email protected]')
            ->subject('Time for Symfony Mailer!')
            ->text('Sending emails is fun again!')
            ->html('<p>See Twig integration for better HTML integration!</p>');


Source: Symfony Questions