Email builder core. Provides useful methods to inline css, send tests to Litmus and send email tests
npm install email-builder-coreemail-builder-core
==================
 
Email builder core for export into other projects
Example:
``javascript`
var EmailBuilder = require('email-builder-core');
var emailBuilder = new EmailBuilder({ encodeSpecialChars: true });
The following options may support all available methods of EmailBuilder. However there some that are only needed for a particular method.
options.encodeSpecialChars
Type: Boolean false
Default: All
Supported Method(s):
Encodes special characters to their HTML numerical form e.g. © --> ©
options.relativePath
Type: String ''
Default: emailBuilder.inlineCss
Supported Method(s):
This option must be set when passing a Buffer or a String to the inlineCss method. That way it has a relative path to any css files. The path should be whatever directory your src file is in.
options.litmus
Type: Object {}
Default: username
Properties: , password, url, applications emailBuilder.sendLitmusTest
Supported Method(s):
Example:
`javascript
litmus : {
// Optional, defaults to title of email or yyyy-mm-dd if
// Litmus username
username : 'username',
// Litmus password
password : 'password',
// Url to your Litmus account
url : 'https://yoursite.litmus.com',
// Email clients to test for. Find them at http://yoursite.litmus.com/emails/clients.xml
// The
applications : ['gmailnew', 'hotmail', 'outlookcom', 'ol2000', 'ol2002', 'ol2003', 'ol2007', 'ol2010','ol2011', 'ol2013', 'appmail8', 'iphone5', 'ipad3']
}
`
options.emailTest
Type: Object {}
Default: to
Properties: , from, subject, nodemailer emailBuilder.sendEmailTest
Supported Method(s):
The optional nodemailer property is an object that has transporter and defaults properties. These get passed to the nodemailer.createTransport() method. You can use transport plugins or play with the default SMTP options for the nodemailer.transporter property
Example:
`javascript
emailTest : {
// Email to send to
to : 'toEmail@email.com',
// Email sent from
from: 'fromEmail@email.com',
// Your email Subject
subject : 'Email Subject',
// Optional
nodemailer: {
transporter: {
service: 'gmail',
auth: {
user: 'gmailuser',
pass: 'gmailpass'
}
},
defaults: {}
}
}
`
options.juice
Type: Object {}
Default: extraCss
Supported Properties: , applyWidthAttributes, applyAttributesTableElements emailBuilder.inlineCss
Supported Method(s):
View Juice options
options.cheerio
Type: Object {}
Default:
View Cheerio options.
All methods return a promise, the underlying promise library we use is Bluebird. Methods can be used seperately, or chained together using the .then method. If you're not familiar with promises, instead of using a callback, you chain a .then method to get the results.
Inlines css from embedded or external styles. It'll automatically remove any link or style tags unless one of the data attributes below are used. View test fixtures to see examples.
Arguments
file - String containing path to file string - String of HTML buffer - Buffer of HTML
HTML data attributes
There are two supported data attributes that you can apply to \
Body