npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

transactional-email-templates

v0.4.0

Published

Customizable transitional HTML email templates for node.js, compiled with variable content

Downloads

3

Readme

transactional-email-templates

Customizable transitional HTML email templates for Node.js, compiled with variable content. Each template is responsive and each has been tested in all the popular email clients.

Transactional email templates

Usage

const templates = require('transactional-email-templates');

const alertEmailHTML = templates.alert({
    title: 'You are approaching your limit',
    alert: "Warning: You're approaching your limit. Please upgrade.",
    alertColor: '#FD9E28',
    bodyElements: [
        'You have <strong>1 free report</strong> remaining.'
        "Add your credit card now to upgrade your account to a premium plan to ensure you don't miss out on any reports.",
    ],
    link: 'http://www.mailgun.com/',
    linkCTA: 'Confirm Email Address',
    linkColor: '#3A90D7',
    byline: 'Thanks for choosing Acme, Inc.',
    unsubscribeLink: 'https://www.mailgun.com',
    unsubscribeLinkText: 'Unsubscribe from these alerts.',
});
// yields http://mailgun.github.io/transactional-email-templates/alert.html

const currency = '$';
const totalCost = 33.98;
const billingEmailHTML = templates.billing({
    title: 'Paid',
    headline: `${currency} ${totalCost} Paid`,
    addressElements: [
        'Lee Munroe',
        'Invoice #12345',
        'June 01 2014',
    ],
    lineItems: [
        { title: 'Service 1', amount: 19.99 },
        { title: 'Service 2', amount: 9.99 },
        { title: 'Service 3', amount: '4.00' },
    ],
    link: 'https://mailgun.com',
    linkCTA: 'View in browser',
    byline: 'Acme Inc. 123 Van Ness, San Francisco 94102',
    footerText: 'Questions? Email ',
    footerLink: 'mailto:[email protected]',
    footerLinkText: '[email protected]',
    currency,
    totalCost,
});
// yields http://mailgun.github.io/transactional-email-templates/billing.html

const actionEmailHTML = templates.action({
    title: 'Reset your password',
    bodyElements: [
        'Please confirm your email address by clicking the link below.',
        'We may need to send you critical information about our service and it is important that we have an accurate email address.',
    ],
    link: 'http://www.mailgun.com/',
    linkCTA: 'Confirm Email Address',
    linkColor: '#3A90D7',
    byline: '- The Mailgunners',
    footerText: 'Follow ',
    footerLink: 'http://twitter.com/mail_gun',
    footerLinkText: '@Mail_Gun on Twitter',
});
// yields http://mailgun.github.io/transactional-email-templates/action.html

Options

/**
 * Build alert email HTML
 * module.exports.alert
 *
 * @access public
 * @param {Object} data
 * @param {String} data.title
 * @param {String} data.alert
 * @param {String} [data.alertColor]
 * @param {String[]} data.bodyElements
 * @param {String} data.link
 * @param {String} data.linkCTA
 * @param {String} [data.linkColor]
 * @param {String} [data.byline]
 * @param {String} data.footerText
 * @param {String} [data.footerLink]
 * @param {String} [data.footerLinkText]
 * @param {String} [data.unsubscribeLink]
 * @param {String} [data.unsubscribeLinkText]
 * @returns {String} HTML email content
 */

/**
 * Build action email HTML
 * module.exports.action
 *
 * @access public
 * @param {Object} data
 * @param {String} data.title
 * @param {String[]} data.bodyElements
 * @param {String} data.link
 * @param {String} data.linkCTA
 * @param {String} [data.linkColor]
 * @param {String} [data.byline]
 * @param {String} data.footerText
 * @param {String} [data.footerLink]
 * @param {String} [data.footerLinkText]
 * @param {String} [data.unsubscribeLink]
 * @param {String} [data.unsubscribeLinkText]
 * @returns {String} HTML email content
 */

/**
 * Build billing/invoice email HTML
 * module.exports.billing
 *
 * @access public
 * @param {Object} data
 * @param {String} data.title
 * @param {String} [data.alert]
 * @param {String} [data.alertColor]
 * @param {String} [data.headline]
 * @param {String[]} data.bodyElements
 * @param {String[]} data.addressElements
 * @param {String} [data.link]
 * @param {String} [data.linkCTA]
 * @param {String} data.currency
 * @param {String} data.totalTitle
 * @param {Number|String} data.totalCost
 * @param {LineItem[]} data.lineItems
 * @param {String} [data.byline]
 * @param {String} data.footerText
 * @param {String} [data.footerLink]
 * @param {String} [data.footerLinkText]
 * @param {String} [data.unsubscribeLink]
 * @param {String} [data.unsubscribeLinkText]
 * @returns {String} HTML email content
 */

/**
 * @typedef {Object} LineItem
 * @property {String} title
 * @property {Number|String} amount
 */

Install

$ npm install transactional-email-templates --save

Acknowledgments