A little improved version of fritx/gulp-mail
.
Installing via npm:
npm install --save-dev gulp-mailing
- options:
Object
gulp-mailing
uses Nodemailer v3. Available options for gulp-mailing
are:
Type: Object
Contains required SMTP configuration values. (See the example below.)
Type: String|Array
A string or array containing one or more than one recipient address, respectively.
Type: String
The display name for the sender.
Type: String
The email subject line. If not provided, a default subject line is generated from the source filename as [TEST] path.basename
.
Type: String
The HTML body of the email. If not provided, the source file becomes the message body.
Type: String
The plaintext body of the email. If not provided, Nodemailer generates this based on the source file.
Type: Array
This array will be passed to Nodemailer's message object, pleach check its document here for details.
Currently, gulp-mailing
takes in piped streams and sends emails via SMTP only.
var gulp = require('gulp');
var mail = require('gulp-mailing');
var smtpInfo = {
auth: {
user: 'user@example.com',
pass: 'example_password'
},
host: 'smtp.example.com',
secureConnection: true,
port: 465
};
gulp.task('mail', function () {
return gulp.src('./mails/i-love-you.html')
.pipe(mail({
subject: 'Example',
to: [
'user2@example.com'
],
from: 'Example <user@example.com>',
smtp: smtpInfo
}));
});