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

alinex-mail

v1.3.0

Published

Easy email sending with configuration support.

Downloads

5

Readme

Alinex Mail: Readme

GitHub watchers

GitHub stars GitHub forks

npm package latest version

Travis status Coveralls status Gemnasium status GitHub issues

An easy to use module for sending mails.

  • fully configurable
  • configuration templates
  • using markdown with auto text/html creation
  • support for handlebars templates

While sending mails it will also transform inline images in html into cid images attached to the mail to make it more standard conform.

It is one of the modules of the Alinex Namespace following the code standards defined in the General Docs.

Read the complete documentation under https://alinex.github.io/node-mail.

Install

NPM Downloads

The easiest way is to let npm add the module directly to your modules (from within you node modules directory):

npm install alinex-mail --save

And update it to the latest version later:

npm update alinex-mail --save

This package will install a lot of subpackages to ensure the full functionality but only the ones really needed are loaded on demand.

Always have a look at the latest changes.

Usage

The first step is to load the module:

mail = require 'alinex-mail'

And now you simply send your mails:

mail.send
  base: 'default'
  subject: 'Test'
, context, (err) ->
  # handling of errors or success

The above setup is all you may need to send an email. All the missing information is taken from it's base. Which is like always defined as a configuration setting.

The context is optional and only used if the mail's body contains handlebars templates.

If you want to validate email settings within you applications configuration, you may use the schema from this package:

emailSchema = require('alinex-mail/lib/configSchema').email

You may also resolve the email templates before sending it:

setup = mail.resolve setup

Configuration

The configuration is based on multiple email templates. They can be made on top of each other.

They will be defined under /email and an example may look like:

# Email Templates
# =================================================


# Default Email Templates
# -------------------------------------------------
# This will extend/overwrite the already existing setup within the code.
default:
  # specify how to connect to the server
  transport: smtp://alexander.schilling%40mycompany.de:<PASSWORD>@mail.mycompany.de
  # specify retries
  retry:
    times: 1 # makes 2 tries at max
    interval: 5s
  # sender address
  from: [email protected]
  replyTo: [email protected]

  # content
  locale: en
  subject: >
    Database Report: {{name}}
  body: |+
    {{conf.title}}
    ==========================================================================

    {{conf.description}}

    Started at {{dateFormat date "LLL"}}:

    | Zeilen | Datei    | Beschreibung |
    | ------:| -------- | ------------ |
    {{#each result}}
    | {{rows}} | {{file}} | {{description}} |
    {{/each}}

    Find the files attached to your mail if data available!

To make it more modular you may also add a base setting to use the setting defined there as a base and the options here may overwrite or enhance the base setup.

Read more at the {@link configSchema.coffee} page.

Debugging

If you have any problems you may always run it with debugging by setting the DEBUG environment variable like:

DEBUG=mail* myprog-usingsshtunnel

The following targets are possible:

  • mail general logging
  • mail:data output all mail elements instead of only the envelope

If you enable debugging of mail the given configuration will also be validated.

License

(C) Copyright 2016 Alexander Schilling

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.