<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\Annotation\Route;
class EntryPointController extends AbstractController
{
/**
* @Route("/entry/point", name="entry_point")
*/
public function index(MailerInterface $mailer): Response
{
return $this->render('entry_point/index.html.twig', [
'controller_name' => 'EntryPointController',
]);
}
/**
* @Route("/test/email/config", name="test_email_config")
*/
public function emailConfig(MailerInterface $mailer): Response
{
$email = (new Email())
->from('gitlab@sogec-marketing.net')
->to('nsagouis@sogec-marketing.com')
->subject('Time for Symfony Mailer!')
->text('Sending emails is fun again!')
->html('<p>See Twig integration for better HTML integration!</p>');
$mailer->send($email);
return new JsonResponse(["status" => "email sent"]);
}
}