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

@informatiqal/publiqate-smtp

v1.0.0

Published

SMTP Publiqate plugin

Downloads

68

Readme

Publiqate SMTP

Generic SMTP plugin for Publiqate

Build and Installation

Clone this repository. Navigate to the plugins -> smtp folder and run:

npm run build

Once the build process is complete the compiled code will be available in plugins -> smtp -> dist folder.

Copy the content of the dist folder somewhere on the server, where Publiqate is running and specify the location from where Publiqate will load the plugin.

Once the config is set either restart the Publiqate service or visit the admin UI and press "Refresh config".

Example config:

...
plugins:
  - c:\path\to\smtp\plugin\dist\index.js
...
notifications:
  - type: Stream
    ...
    callbacks:
      - type: mail
        details:
          host: some-host-or-ip
          port: 123
          from: [email protected]
          to:
            - [email protected]
            - [email protected]
          subject: "Stream updated"
          # html: <h1>Stream updated</h1><br><div>Stream has been updated</div>
          template: c:\path\to\template.ejs # see Templates section for details
          engine: handlebars # or ejs, pug, mustache
          auth:
            user: some-user
            pass: secret-password
...

Options

  • host - SMTP server host/ip
  • port - SMTP server port
  • secure - optional. boolean. Default is true
  • proxy - optional. TCP proxy
  • from - email address from which the emails will be send
  • to - array of emails
  • subject - email subject
  • html - HTML string to be used as the mail body. If html and template are present then only template is used
  • template - full path to the EJS template to use (see Templates section for details)
  • headers - optional. List of additional headers (header-name: header-value)
  • auth - see Authentication section

Authentication

Three authentication methods are supported:

User and pass

Very basic one. Provide user and pass properties

3-legged legged OAuth

  • user - user email address
  • clientId - the registered client id of the application
  • clientSecret - the registered client secret of the application
  • refreshToken - optional. If it is provided then tries to generate a new access token if existing one expires or fails
  • accessToken - he access token for the user. Required only if refreshToken is not available
  • expires - optional. expiration time for the current accessToken
  • accessUrl - optional. HTTP endpoint for requesting new access tokens. This value defaults to Gmail

For more information have a look at 3-legged OAuth2 authentication

2LO OAuth

  • user - user email address you want to send mail as
  • serviceClient - service client id. Found it in the service key file (client_id field)
  • privateKey - private key content. Found it in the service key file (private_key field)

For more information have a look at 2LO authentication (service accounts)

Templates

The plugin support 4 template engines:

For each template engine error log entry will be generated if the template fails to compile/render.

Examples how to render list of names for all entities in the notification for each template engine:

EJS

<ul><% entities.forEach((entity,index) => {%>
  <li><%= entity.details.name %></li><% }) %>
</ul>

Handlebars

<ul>
  {{#each entities}}
    <li>{{this.details.name}}</li>
  {{/each}}
</ul>

Pug

ul
  each n in entities
    li= n.details.name

Mustache

<ul>
  {{#entities}}
    <li>{{details.name}}</li>
  {{/entities}}
</ul>