Email Service
Sending emails in VitNode.
In VitNode we're implementing helper to send emails with React Email which allows you to create beautiful responsive emails using React.
Provider
Before you start sending emails, you need to install the provider. Choose one of the following:
Usage
Templates using React
Create a new file for your email template.
You can read more about React Email here.
Import into your service and use it like this:
Internationalization (i18n)
We're created a helper function getTranslationForEmail(namespace, language)
to translate the email templates. You can use it like this:
...or in your service.
namespaces
are working the same as in the frontend.Template Helpers
We're providing some helper functions to make your life easier. Using this.emailHelpersService.getHelpersForEmail()
you can get the following values like:
- frontend_url,
- site_name,
- site_short_name
Modify the service to inject EmailHelpersService
.
Checking if email is enabled
You can check if email is enabled by using this.mailService.checkIfEnable()
: