Skip to content

Email Service

Interface to send email notifications. In Stack9

  • Send Email
     from: { email: "", name: "Stack9" }, // optional, if didn't specified, it will use the env environments
     to: [
       { email: "", name: "Mail1" }
     templateId: "1234567899", // transactional template id
     dynamicTemplateData: {
       firstname: "Name",
       address: "St test",
       //... any data goes here
  .catch((error) => logger.error(error, "Error email"));
  • Check if the template id exists in SendGrid
try {
} catch (e) {
    { SendGridTemplateId: templateIdToUse, Exception: e },
    'Send Grid Template {SendGridTemplateId} could not be found. {Exception}',

If running in a non production environment, the email service will check and filter allowed emails/domains in the property allowedAccountsForNonProdEmailSending defined in the app.json file.

More information about allowedAccountsForNonProdEmailSending in app-structures ⇗