Mailer From

This commit is contained in:
Frank
2026-01-11 23:10:30 +01:00
parent f3bf472bc6
commit f96e51420f
5 changed files with 5 additions and 3 deletions

2
.env
View File

@@ -53,7 +53,7 @@ MAILER_DSN=smtp://mailer:1025
# Alternatively, via SMTP (no extra package needed):
# MAILER_DSN="smtp://apikey:%env(SENDGRID_API_KEY)%@smtp.sendgrid.net:587?encryption=tls"
# Optional default sender (used by test command if --from not passed):
# MAILER_FROM=no-reply@your-domain.tld
MAILER_FROM=noreply@escapepage.dev
SENDGRID_API_KEY=your_real_key_goes_here
###< symfony/mailer ###

View File

@@ -6,6 +6,7 @@ APP_SECRET=a8f89e179e8c338423697669d6728c2c
### Prefer storing SENDGRID_API_KEY using Symfony Secrets or real env vars.
###> symfony/mailer ###
MAILER_DSN=sendgrid://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@default
MAILER_FROM=mailer@escapepage.nl
###< symfony/mailer ###
###> symfony/framework-bundle ###

View File

@@ -4,6 +4,7 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
mailer_from: '%env(MAILER_FROM)%'
services:
# default configuration for services in *this* file

View File

@@ -9,6 +9,6 @@ opcache.validate_timestamps=1
opcache.revalidate_freq=0
log_errors=On
error_log=/var/www/html/var/log/errorlog_php.txt
error_log=/var/www/html/var/log/errorlog_php.log
session.gc_maxlifetime=1440
session.cookie_lifetime=0

View File

@@ -39,7 +39,7 @@ class RegistrationController extends AbstractController
// generate a signed url and email it to the user
$emailVerifier->sendEmailConfirmation('app_verify_email', $user,
(new TemplatedEmail())
->from('noreply@escapepage.dev')
->from($this->getParameter('mailer_from'))
->to($user->getEmail())
->subject('Please Confirm your Email')
->htmlTemplate('tech/registration/confirmation_email.html.twig')