/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.

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.

Parameters:
NameTypeDescription
emailsArray
Properties
NameTypeDescription
params.toString

The email recipient.

params.templateString

The html that will make up the body of the email.

params.languageString

The language to be used.

params.hostString

The URL of the instance.

(async, inner) getBody(template)

Retrieves the body of the text from the provided url/file.

Parameters:
NameTypeDescription
templateObject
Properties
NameTypeDescription
template.textString

The url from which to retrieve the text content using module:/provider/getFrom~flyTo.

template.htmlString

The url from which to retrieve the html content using module:/provider/getFrom~flyTo.

(inner) replaceStringParams(string) → {String}

Substitutes supplied params into a supplied string.

Parameters:
NameTypeDescription
stringString
Properties
NameTypeDescription
paramsObject

The url from which to retrieve the text content using module:/provider/getFrom~flyTo.

Returns:

The string with substitutions made.

Type: 
String

(async, inner) send(params)

Sends one email via the resend sdk.

Parameters:
NameTypeDescription
paramsObject
Properties
NameTypeDescription
params.toString

The email recipient.

params.templateString

The html that will make up the body of the email.

params.languageString

The language to be used.

params.hostString

The URL of the instance.