bem-site-mail-sender
v0.0.2
Published
E-Mail sending helper. Simple wrapper around nodemailer module
Maintainers
Readme
mail-sender
E-Mail sending helper. Simple wrapper around nodemailer module
Usage
Add mail-sender dependency to your project:
npm install --save bem-site-mail-senderAdd mail-sender requirement to the code of your module:
var sender = require('bem-site-mail-sender').create({
host: 'smtp.yandex.net', // your smtp e-mail host
port: 25 // your smtp e-mail port
});API
sendHtml
For sending e-mails with html body
Arguments:
- {String} from - e-mail of sender
- {Array} to - array of recipients e-mails
- {String} subject of e-mail
- {String} html body of e-mail
- {Function} callback function
Example:
sender.sendHtml('[email protected]', ['[email protected]'], 'Hello World Subject', '<h1>Hello World</h1>', function (err) {
console.log('done');
});sendWithAttachments
For sending e-mails with attached file(s)
Arguments:
- {String} from - e-mail of sender
- {Array} to - array of recipients e-mails
- {String} subject of e-mail
- {String} text body of e-mail
- {Array} attachments - array of attachment objects
- {Function} callback function
Example:
var attachments = [{
filename: 'package.json',
path: './package.json
}];
sender.sendWithAttachments('[email protected]', ['[email protected]'],
'Hello World Subject', 'Hello World', attachments, function (err) {
console.log('done');
});Testing
Run tests:
npm run mochaRun tests with istanbul coverage calculation:
npm run istanbulRun codestyle verification (jshint and jscs)
npm run codestyleMaintainer @tormozz48 Please send your questions and proposals to: [email protected]

