/utils/resend
The resend module provides a way to send emails to clients/admins, etc.
The resend dependency will be imported dynamically on the condition that a TRANSPORT_EMAIL [sender] is defined the process environment.
The mailer object has two methods. send and batch. The send function sends one email. And the batch function queues a batch of emails to be sent.
- Source
Requires
Methods
(async, inner) batch(emails)
Takes an array of emails to queue via the resend sdk. This allows us to trigger 100 emails at once.
| Name | Type | Description |
|---|---|---|
emails | Array |
| Name | Type | Description |
|---|---|---|
params.to | String | The email recipient. |
params.template | String | The html that will make up the body of the email. |
params.language | String | The language to be used. |
params.host | String | The URL of the instance. |
- Source
(async, inner) getBody(template)
Retrieves the body of the text from the provided url/file.
| Name | Type | Description |
|---|---|---|
template | Object |
| Name | Type | Description |
|---|---|---|
template.text | String | The url from which to retrieve the text content using module:/provider/getFrom~flyTo. |
template.html | String | The url from which to retrieve the html content using module:/provider/getFrom~flyTo. |
- Source
(inner) replaceStringParams(string) → {String}
Substitutes supplied params into a supplied string.
| Name | Type | Description |
|---|---|---|
string | String |
| Name | Type | Description |
|---|---|---|
params | Object | The url from which to retrieve the text content using module:/provider/getFrom~flyTo. |
- Source
The string with substitutions made.
- Type:
- String
(async, inner) send(params)
Sends one email via the resend sdk.
| Name | Type | Description |
|---|---|---|
params | Object |
| Name | Type | Description |
|---|---|---|
params.to | String | The email recipient. |
params.template | String | The html that will make up the body of the email. |
params.language | String | The language to be used. |
params.host | String | The URL of the instance. |
- Source