fix mailing #9

Merged
csimonis merged 1 commits from bugfix/mailing into main 2025-01-23 18:37:19 +00:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 094ee2c3d6 - Show all commits

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);