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

practio-email

v1.1.0

Published

Service to send emails

Downloads

1

Readme

practio-email

This service enables any other service to send an email. Practio-email listens to email.send commands, generates the email based on the template indicated in the command and then uses Amazon's Simple Email Service to send the email. The email.send command should have the following structure:

{
  to: '[email protected]', // required
  template: 'phoneBookingConfirmation', // required
  emailData: {
    ...any custom data needed by the template
  },
  locale: 'en-GB' // optional, will default to 'en-GB' if not set
}

It is also possible to includes attachments in the email by pointing to files stored on S3:

{
  to: '[email protected]',
  template: 'phoneBookingConfirmation',
  emailData: {
    ...any custom data needed by the template
  },
  locale: 'en-GB',
  attachments: [
    {
      bucket: 'bucketName',
      key: 'my-s3-file-key.pdf',
    },
    {
      bucket: 'bucketName',
      key: '6ff6a20d-0f3c-4309-8d9d-f6a219a06343.pdf',
      fileName: 'receipt.pdf', // you can provide a different name than the s3 key name for the file
    },
  ]
}

Development

Start the service with npm start.

Then navigate to http://localhost:10070/ to test out the templates you are developing.

Testing in different email clients

In order to check if the email looks fine in different email clients you can use litmus.com. In 1Password search for litmus to find the user for our account.

Sending emails locally

Create a new file called auth.json and add the following information:

{
  "aws": {
    "sesAccessKeyId": "COPY_FROM_HEROKU_STAGING",
    "sesSecretKey": "COPY_FROM_HEROKU_STAGING"
  }
}

Head to Heroku staging practio-email app and copy the following Config Vars:

  • AWS_SES_ACCESS_KEY_ID
  • AWS_SES_SECRET_KEY

Note: this will only work with @practio.com mail addresses.

Templates

Templates are defined in the /server/emails/templates folder (they are server-side rendered). All HTML used inside a template must be done with MJML, to ensure that our emails work across many different email clients and that they are responsive.

All template names must be exposed in the @practio/email-templates module found in the packages folders here. So when you add a new e-mail template, then remember to publish a new version of the module by running npm run publish in the root of this repository.

Email assets

All assets used in emails (typically pictures) can be added to the /assets/ folder where they can be accessed for local development.

For staging and production these assets must also be added to the AWS S3 bucket containing our assets called email-assets.practio.com found here.

All these assets will be served via Cloudfront which you can see by looking at the assetsUrl property in the staging and production config files.