Email Configuration
If you want to submit an email in headless, you should use the mail resolver.
In this example, we use the email template paths resolver, but it's possible to use different email resolver (See section "Email Resolver" below)
opendxp_headless:
email_template_paths:
my_email_document_path: /{_site}/{_locale}/my-path/to/email-document
$this->mailResolver->resolve('my_email_document_path', [
'headlessContextStack' => $command->getHeadlessContextStack(),
'recipient' => $user->getLoginIdentifier(), // optional
'parameters' => [
'aParameter' => $whichIsAvailableInMailDocument,
],
]);
Email Resolver
Template Path Resolver
This is available in headless core and is a simple path mapping configuration:
opendxp_headless:
email_template_paths:
my_email_document_path: /{_site}/{_locale}/my-path/to/email-document
Custom Resolver
Take a look at the headless coreshop mail resolver which is also a custom email resolver
Core Mail Resolver Events
In headless bundle there are some points, where we need to dispatch email notifications.
Note! You need to add those identifiers (like "user_password_reset_request") to the configuration first (like described above)
| Name | Description | Params |
|---|---|---|
user_password_reset_request | Fires, when a password reset has been requested (If coreshop is installed, this will be handled by coreshop notifications) | resetLink, user |
user_password_reset | Fires, after a new password has been set | user |
user_password_change_password | Fires, after a password a logged-in user has been changed | user |
user_login_identifier_change_request | Fires, after the login identifier (e.g. email-address) has been requested | user |
user_login_identifier_change | Fires, after the login identifier on a logged-in user has been set | user |
Email-Templates
There are some required emails, you need to add:
user_password_reset_request
<p>Hallo,</p>
<p>Bitte benutzen Sie folgenden Link, um das Passwort zurückzusetzen:</p>
<p>{{ resetLink }}</p>
<p>Falls Sie Ihr Passwort nicht zurücksetzen wollten, ignorieren Sie dieses E-Mail.</p>
user_login_identifier_change_request
<p>Hallo {{ user.firstName }} {{ user.lastName }},</p>
<p>bitte klicken Sie auf folgenden Link, um Ihre neue Email Adresse zu bestätigen: {{ changeLoginIdentifierLink }}</p>