src/Controller/HomePageController.php line 21
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use App\Services\PaaeApiRequests;
use App\Services\ImportPaaeService;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
class HomePageController extends AbstractController
{
#[Route('/', name: 'app_index')]
public function index(HttpClientInterface $httpClient, PaaeApiRequests $request, ImportPaaeService $import): Response
{
$import->importUserData();
return $this->render('home_page/index.html.twig', [
'controller_name' => 'HomePageController'
]);
}
#[Route('/send-email', name: 'email_sender')]
public function email(MailerInterface $mailer, HttpClientInterface $httpClient, PaaeApiRequests $request): Response
{
$email = (new Email())
->from('[email protected]')
->to('[email protected]')
->subject('Email Test')
->text('A sample email using mailtrap.');
$mailer->send($email);
dd($email);
return new Response(
'Email sent successfully'
);
}
}