Overview
You need to set up an email service to send emails to your users. Please do not spam your users with unnecessary emails to avoid being marked as spam. It's important to keep the healthy reputation of your email service provider.
How to Use
Here is an example of how to send an email:
ts
Parameter Options
-
to (required) object
The recipient's email address and name.
-
email (required) string: The valid recipient's email address.
-
name string: The recipient's name.
-
-
subject (required) string: The email subject.
-
from string: The sender's email address (default:
process.env.EMAIL_FROM
). -
body (required) object
Build the email content with HTML string OR template. It supports the template engine format by using
{{param}}
(or,{{{param}}}
to prevent escaping) syntax and provide the parameters in theparams
object.-
html string: The email content in HTML format.
-
template string: The email template name without the
.html
extension. Make sure to create the template in thetemplates/email
folder as an HTML file. -
params object: The email template parameters.
-
Create Email Template
You can create a simple and beautiful email template for free with Maily. Copy and save the generated HTML code in the templates/email
folder.