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 🙏

© 2025 – Pkg Stats / Ryan Hefner

parse-server-sendmail-template-adapter

v1.1.0

Published

Used to send Parse Server emails though sendmail using HTML templates

Readme

parse-server-sendmail-template-adapter

npm build-status downloads npm-issues js-standard-style

This mail adapter for Parse Server uses sendmail to send emails.

This code is inspired by parse-server-sendmail-adapter.

Installation

Put parse-server-sendmail-template-adapter in the dependencies object of your project's package.json file.

"dependencies":
{
    "parse-server-sendmail-template-adapter": "^1.0.0"
}

Usage

The initializer takes a single object parameter with the following fields:

| Field Name | Description | |:-----------------------|--------------------------------------------------------------------------| | fromAddress | the address to send from (i.e. [email protected]) | | verificationSubject | the subject for new account verification emails | | verificationBody | the body for new account verification emails (inline text or a filename) | | passwordResetSubject | the subject for password reset emails | | passwordResetBody | the body for password reset emails (inline text or a filename) | | userFields | the custom items from the user object to pull for use in templates |

fromAddress is the only required field to get setup.

mailAdapter object

For readability I confine all the mail adapter configuration items for parse servers in their own object called emailAdapter that I then supply to the server's constructor.

var server = new ParseServer({
    // sends a verification when users add and email to their account
    verifyUserEmails: true,
    // the amount of time they have to reset their password in seconds
    emailVerifyTokenValidityDuration: 2 * 60 * 60,
    // the settings for the mail adapter for the server
    emailAdapter: emailAdapter
});

Here are some examples of how to set up the emailAdapter object using this mail adapter with text files, HTML templates, or inline strings.

Simple example

This example uses the default verification and password reset subjects and bodies.

var emailAdapter =
{
    module: require('parse-server-sendmail-template-adapter'),
    options:
    {
        fromAddress: '[email protected]',
    }
};

Example using file bodies and inline subjects

This example uses HTML files as templates for the body.

var emailAdapter =
{
    module: require('parse-server-sendmail-template-adapter'),
    options:
    {
        fromAddress: '[email protected]',
        verificationSubject: 'Confirm your %appname% account',
        verificationBody: 'templates/inlined/verify_email.html',
        passwordResetSubject: 'Reset your %appname% password',
        passwordResetBody: 'templates/inlined/reset_password.html'
    }
};

Example using inline fields

This example uses inline strings to define the body contents of the emails.

var emailAdapter =
{
    module: require('parse-server-sendmail-template-adapter'),
    options:
    {
        fromAddress: '[email protected]',
        verificationSubject: 'Confirm your %appname% account',
        verificationBody: `Hi,

        You are being asked to confirm the e-mail address %email% with %appname%

        Click here to confirm it:
        %link%`,
        passwordResetSubject: 'Reset your %appname% password',
        passwordResetBody: `Hi,

        You requested a password reset for %appname%.

        Click here to reset it:
        %link%`
    }
};

Templates

The adapter uses templating to use generalized email formats to provide unique information to users. By default there are 4 items that can be used in templates:

| Template Key | Description | |:-------------|:------------------------------------------------------------------------| | %appname% | The name of the app as it appears in the Parse Server configuration | | %link% | The unique link to provide in the email for web app feature integration | | %username% | The username of the user receiving an email | | %email% | The email address of the user receiving an email |

Example using custom user fields in templates

This example uses custom fields from the user object in its templates. to access the dynamic values in userField in a template, surround it with %s. i.e. if a user is sent an email using the following template it would be replaced with items from the user object.

  • Hi %firstName% %lastName%! -> Hi Jacob Smith!
var emailAdapter =
{
    module: require('parse-server-sendmail-template-adapter'),
    options:
    {
        fromAddress: '[email protected]',
        userFields: ["firstName", "lastName"]
    }
};