Home Applications templated_email

templated_email

by Nikolay Solovyev and 1 others
InterSystems does not provide technical support for this project. Please contact its developer for the technical assistance.
0
0 reviews
0
Awards
10
Views
0
IPM installs
0
0
Details
Releases (2)
Reviews
Issues
This app has a demo View
InterSystems IRIS module for sending Jinja2-based emails

What's new in this version

added function to get schema from template

templated_email

InterSystems IRIS module for sending Jinja2-based emails

Overview

This module provides an Interoperability Business Operation and utility classes to render email templates using Jinja2 + Markdown, and send them via email.

It is designed to work both within InterSystems Interoperability productions and from standalone ObjectScript code, making it suitable for a wide range of use cases.

Installation

npm install templated-email

Quick Start

Using the package within Interoperability productions

  1. Install the package
  2. Create credentials http://{hostname}:{port}/csp/user/EnsPortal.Credentials.zen to access SMTP server
  3. Add Business Operation TemplatedEmail.BusinessOperation to your production.
  4. On the Production configuration page, configure the Business Operation as you would for any operation using the EnsLib.EMail.OutboundAdapter:
    • Set the SMTP server, port, credentials, etc.
    • Additionally, you may specify the TemplateFolder setting to define the directory where your templates are stored (optional)
  5. Use TemplatedEmail.EmailRequest to trigger the operation

Using from ObjectScript

Anywhere in your ObjectScript code where you use %Net.MailMessage, you can replace it with TemplatedEmail.MailMessage.

This extended class provides two additional methods:

  • applyBodyTemplate() — renders and sets the email body using a Jinja2 + Markdown template
  • applySubjectTemplate() — renders and sets the email subject using a Jinja2 template

This allows you to easily integrate dynamic templated content into your emails.

Components Description

  1. TemplatedEmail.TemplateService - utility class that contents methods for templates processing
  2. TemplatedEmail.EmailRequest - Interoperbility Message for Business Operation
    • Data:%DynamicObject - data that will be used while rendering Templates
    • BodyTemplateFilename:%String - path to the mail template
    • BodyTemplate:%String - mail template text. One of BodyTemplateFilename or BodyTemplate must be specified
    • SubjectTemplateFilename:%String - path to the mail template
    • SubjectTemplate:%String - mail template text. One of SubjectTemplateFilename or SubjectTemplate must be specified
    • Recipients:%String - Comma and/or semicolon separated list of recipients
    • FromAddress:%String - From address to put in sent mail messages
  3. TemplatedEmail.BusinessOperation - Business Operation for processing and sending template emails
  4. TemplatedEmail.MailMessage - inheritant of the %Net.MailMessage for use in Business Operation

Demo

Local

  1. Clone the repository
git clone https://github.com/nsolov/templated_email.git
  1. Build the container
docker compose up -d
  1. Create credentials (http://localhost:52796/csp/user/EnsPortal.Credentials.zen) to access SMTP server
    set_creds

  2. On Production configuration page for “emails” Business Operation specify your smtp server, port and credentials
    (http://localhost:52796/csp/user/EnsPortal.ProductionConfig.zen?PRODUCTION=Demo.TemplatedEmail.Production)
    setup_bo

  3. Run production

  4. Run Test for TestProcess

    • specify your for credentials in From field
    • specify your recipient in To field
    • select “file” or “string” option

    test_bo

Online Demo

Look for the link in the OEX Package
online_demo

Requirements

  • InterSystems IRIS 2023.1+

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License - see https://github.com/nsolov/templated_email/blob/master/LICENSE file for details.

Support

Made with
Install
zpm install templated-email download archive
Version
1.0.127 Jul, 2025
Ideas portal
Category
Integration
Works with
InterSystems IRIS
First published
27 Jul, 2025
Last edited
27 Jul, 2025