emailah

2.0.0 • Public • Published

** Consider this to be very experimental - do not use in production **

Emailah

Given a path to an HTML file, returns a promise for a "mail" object suitable for sending via Nodemailer.

  • Subject is inferred from title tags
  • Image sources relative to the HTML file are automatically inline-embedded
  • Uses dust as a template engine
  • Uses juice for inlining CSS

Install

npm install emailah

Usage

Class: EmailTemplate

.constructor( templatePath )

.build( [dustContextVars], [defaultMailOptions] ) -> Promise object

.buildEML( [dustContextVars], [defaultMailOptions] ) -> Promise Buffer

Example

// create template from dust file
var t = require('emailah')("./template.dust");
 
// build the mail object used by the transport
t.build({ greeting: 'Hello' }, { to: "user@example.com" }).then(mail => {
    transport.sendMail(mail);
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    2
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i emailah

Weekly Downloads

2

Version

2.0.0

License

ISC

Last publish

Collaborators

  • flamescape