src/Controller/DefaultController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Component\Routing\Annotation\Route;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Request;
  6. class DefaultController extends AbstractController
  7. {
  8.     /**
  9.      * @Route("/", name="homepage")
  10.      */
  11.     public function indexAction(Request $request)
  12.     {
  13.     //    $this->TestMail();
  14.         // replace this example code with whatever you need
  15.         return $this->render('default/index.html.twig', [
  16.             'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
  17.         ]);
  18.     }
  19.     private function TestMail()
  20.     {
  21.         $mailer=$this->get('mailer');
  22.         $message = (new \Swift_Message('Hello Email test 365'))
  23.         ->setTo('[email protected]')
  24.         ->setFrom('[email protected]')
  25.         ->setBody(
  26.           "test",
  27.             'text/html'
  28.         )
  29.         
  30.     ;
  31.         $res=$mailer->send($message);
  32.         return $res;
  33.     }
  34. }