Skip to content

A gulp plugin to send emails with or without attachments from a stream of html.

License

Notifications You must be signed in to change notification settings

mmdonaldson/gulp-email

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gulp Email NPM version Build Status

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.

About

A gulp plugin to send emails with or without attachments from a stream of html.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%