gulp-email
v0.0.7
Published
A gulp plugin to send emails with or without attachments from a stream of html.
Downloads
45
Maintainers
Readme
Gulp Email
A gulp plugin to send emails with or without attachments from a stream of html.
Getting Started
Install:
npm install --save-dev gulp-email
How to use:
For example, using mailgun.com(registration it's free and you can send up to 10,000 emails every day.)
Sending an email like report HTML and attaching a file.
var gulp = require('gulp'),
email = require('gulp-email');
var options = {
user: 'api:key-564dfgfead753fghef11c54c1fb',
url: 'https://api.mailgun.net/v2/sandbox4825.mailgun.org/messages',
form: {
from: 'John Doe <[email protected]>',
to: 'Fulano Mengano <[email protected]>',
subject: 'The last dist',
attachment: '@path/to/folder/dist.zip'
}
};
gulp.task('email', function () {
return gulp.src(['./demo/reports/*.html'])
.pipe(email(options));
});
Sending an email without the content of a stream.
var gulp = require('gulp'),
email = require('gulp-email');
var options = {
user: 'api:key-564dfgfead753fghef11c54c1fb',
url: 'https://api.mailgun.net/v2/sandbox4825.mailgun.org/messages',
form: {
from: 'John Doe <[email protected]>',
to: 'Fulano Mengano <[email protected]>',
cc: 'Regis Messac <[email protected]>',
bcc: 'John Smith <[email protected]>',
subject: 'You have an new email',
text: 'text version'
},
form_string: {
html: '<p>Overwrite to html content of stream files.</p>'
}
};
gulp.task('email', function () {
return gulp.src(['./demo/no-matter.html'])
.pipe(email(options));
});
For these examples I am using the API of mailgun.com(I recommend). In this first release only supports mailgun API and is more than enough.