fix mailing

Reviewed-on: http://git.simonis.lol/sites/abiball/pulls/9
This commit is contained in:
Constantin Simonis 2025-01-23 18:37:19 +00:00
parent ebdcc1d4f5
commit 37f762036b
2 changed files with 4 additions and 1 deletions

1
.env
View File

@ -22,4 +22,5 @@ APP_SECRET=
###> symfony/mailer ###
MAILER_DSN=smtp://${MAILER_USER:-null}:${MAILER_PASSWORD:-null}@${MAILER_HOST:-localhost}:${MAILER_PORT:-1025}
CONTACT_MAIL=${CONTACT_MAIL:-contact@localhost}
SENDER_MAIL=${SENDER_MAIL:-noreply@localhost}
###< symfony/mailer ###

View File

@ -13,6 +13,8 @@ final readonly class ContactService
private MailerInterface $mailer,
#[Autowire(env: 'CONTACT_MAIL')]
private string $contactEmail,
#[Autowire(env: 'SENDER_MAIL')]
private string $senderEmail,
){
}
@ -22,7 +24,7 @@ final readonly class ContactService
->htmlTemplate('email/contact.html.twig')
->context(['data' => $data])
->subject('Kontakt aufnahme')
->from($data->email)
->from($this->senderEmail)
->to($this->contactEmail);
$this->mailer->send($mail);