2024-05-06 20:40:05 +00:00
|
|
|
---
|
2024-10-29 18:27:12 +00:00
|
|
|
date: 2020-11-13
|
2024-05-06 20:40:05 +00:00
|
|
|
id: b6e6c503-c614-4bf3-872a-3a6202e2dbfb
|
|
|
|
title: Notification Emails
|
|
|
|
---
|
|
|
|
|
|
|
|
# Description
|
|
|
|
|
|
|
|
Standardized messages used to send notifications to yourself
|
|
|
|
|
|
|
|
# Syntax
|
|
|
|
|
|
|
|
``` php
|
|
|
|
use Symfony\Bridge\Twig\Mime\NotificationEmail;
|
|
|
|
|
|
|
|
$email = (new NotificationEmail())
|
|
|
|
->from('fabien@example.com')
|
|
|
|
->to('fabien@example.org')
|
|
|
|
->subject('My first notification email via Symfony')
|
|
|
|
->markdown(<<<EOF
|
|
|
|
There is a **problem** on your website, you should investigate it
|
|
|
|
right now. Or just wait, the problem might solves itself automatically,
|
|
|
|
we never know.
|
|
|
|
EOF
|
|
|
|
)
|
|
|
|
->action('More info?', 'https://example.com/')
|
|
|
|
->importance(NotificationEmail::IMPORTANCE_HIGH)
|
|
|
|
;
|
|
|
|
```
|