Symfony 8 SPA with Doctrine ORM, Symfony Security, vanilla JS frontend. Migrated from plain PHP (delight-im/auth + raw SQL) to full Symfony stack. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
579 B
PHP
19 lines
579 B
PHP
<?php
|
|
use PHPMailer\PHPMailer\PHPMailer;
|
|
|
|
function sendMail(string $to, string $subject, string $body): void {
|
|
$mail = new PHPMailer(true);
|
|
$mail->isSMTP();
|
|
$mail->Host = SMTP_HOST;
|
|
$mail->SMTPAuth = true;
|
|
$mail->Username = SMTP_USER;
|
|
$mail->Password = SMTP_PASS;
|
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
|
$mail->Port = SMTP_PORT;
|
|
$mail->CharSet = 'UTF-8';
|
|
$mail->setFrom(SMTP_FROM, SMTP_FROM_NAME);
|
|
$mail->addAddress($to);
|
|
$mail->Subject = $subject;
|
|
$mail->Body = $body;
|
|
$mail->send();
|
|
}
|