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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ultrases

v0.1.3

Published

Dead simple email dispatch with AWS SES (Amazon Simple Email Service)

Readme

ultrases Build Status NPM version

Dead simple email dispatch with AWS SES (Amazon Simple Email Service) with templates!

Getting Started

Install the module via npm with: npm install ultrases

var UltraSES = require('ultrases');
var mailer = new UltraSES({...});

Why?

"We already have the AWS SDK for Node, why do we need another module?"

Because the official AWS SDK for Node.js is cumbersome and stuffy. Not to mention those 4 level deep configuration objects. Besides, it prompotes uppercasing the first letter of properties!

  var params = {WhoEvenDoesThat: 'nobody... except amazon'}

UltraSES is a high level "abstraction" - no overkill.

Documentation

Quick Reference:

Setup

Start by creating a new instance of UltraSES. Pass your access key for AWS in this fashion:

var mailer = new UltraSES({
  aws: {
    accessKeyId: 'LOOKATHESEUPERCASELETTERANDNUMBERS123',
    secretAccessKey: 'shhhh+its/asecrettttttttt+42'
  }
}

Alternatively, you may pass a "pre-initialized" AWS SDK object like so:

var aws = require('aws-sdk');
AWS.config.update({...});
var mailer = new UltraSES({sdk: aws});

You can even pass in an initialized SES client object:

var ses = new aws.SES();
var mailer = new UltraSES({client: ses});

You can also supply defaults for sending emails (for example, the "source" address)

var mailer = new UltraSES({
  aws: {...},
  defaults: { from: 'Team Octocat <[email protected]>' }
}

You can always override these defaults when you send the actual emails, of course.

Keep in mind that the parameters you give to various methods adhere to the principles in the AWS SDK for Node. You can pass an array instead of a string for multiple recipients, specify a ReplyTo and ReturnPath address, specify character encodings, and so on.

Sending a Simple Email

The basic method for sending email is mailer.sendText(email, text, done) and it takes (as you can probably see), 3 arguments:

var email = {to: '[email protected]', subject: 'Hello from Octoland!'};
mailer.sendText(email, 'Look at this fantastic email body!', function(err){
    if(err) throw err;
    console.log('email sent!');
  });

Some notes:

  • The emails will be sent from [email protected], because we set that as a default during initialization.
  • You may include the message body in the "email" object instead of as an extra argument var email = {subject: '...', text: '..'})
  • You may send an email to multiple recipients by passing in an array instead of a string to to, as well as provide BCC and CC recipients.

Sending Raw HTML

UltraSES provides a simple wrapper for sending HTML emails. The cool thing about this is that it automatically creates a text version of your HTML for simpler email clients, using html-to-text.

var email = { from: '[email protected]', to: '[email protected]', subject: 'Look at this pretty formatting!' };
mailer.sendHTML(email, '<h1>Why hello there</h1>', function(err){
  if(err) throw err;
  console.log('html email sent!');
});
  • In this example, we overrode the "from" address that we set during initialization.

Sending a Jade Template

Jade is one of the most popular templating engines for Node. UltraSES comes with out of the box support for compiling Jade templates with your "locals" and sending them.

var email = { to: '[email protected]', subject: 'Now that\'s a pretty email' };
var template = { file: './path/to/template.jade', locals: { some: 'local', variables: 'here' } };
mailer.sendTemplate(email, template, function(err){
  if(err) throw err;
  console.log('compiled template email sent');
})
  • If you already have compiled template file, just pass it to mailer.sendHTML.
  • You may pass the contents of Jade template instead of the file path, by using the property contents instead of file:
var template = { contents: ('html' + '\n\t' + 'body' + '\n\t\t' + 'h1 ' + 'Oh, it\'s you again') };

One Last Thing

UltraSES exposes it's internal SES client as provided by the AWS SDK under the property ses, so you can do things like:

mailer.ses.setIdentityFeedbackForwardingEnabled({ForwardingEnabled: true, Identity: '[email protected]'}, function(err, data){}), 

Contributing

Honestly, this module doesn't have much room to grow. It does what it does and aside for bugs (and maybe customizable template engine support?) there isn't much to expand. If you have some cool ideas though, go ahead and do a pull request, or create an issue with your idea!

It's just email, after all. This is '90s technology we're dealing with.

Here is something else I've realized - it's practically impossible to write unit tests for a module that sends email.

Release History

The latest version is always on npm. You can see the tagged versions here or view the commits here.

License

Copyright (c) 2014 Yotam Tanay. Licensed under the MIT license.