Skip to main content

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)

NameDescriptionParams
user_password_reset_requestFires, when a password reset has been requested (If coreshop is installed, this will be handled by coreshop notifications)resetLink, user
user_password_resetFires, after a new password has been setuser
user_password_change_passwordFires, after a password a logged-in user has been changeduser
user_login_identifier_change_requestFires, after the login identifier (e.g. email-address) has been requesteduser
user_login_identifier_changeFires, after the login identifier on a logged-in user has been setuser

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&uuml;ckzusetzen:</p>
<p>{{ resetLink }}</p>
<p>Falls Sie Ihr Passwort nicht zur&uuml;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>