bakat-mailer
Emails services for Bakat.co
how to use
Divine a object from module with configuration
var Mailer = require('bakat-mailer')(CONFIG.Mailgun.auth);
CONFIG.Mailgun.auth
is config to create email transfer and need you pass the value like below
service : 'email service you want to use if not set the default is Mailgun'
user : process.env.MAILGUN_USER || 'your email user from service you use',
pass : process.env.MAILGUN_PASSWORD || 'your passord for email you use'
Sample data you need to send one email
var dataEmail = {
to: "key_way_dee@yahoo.com",
from: "noreply@bakat.co",
subject: "Test Email",
template: "index",
data : req.users
}
to
is email you want to send. this field is require
from
is email as sender, if not setting will use default email 'noreply@bakat.co'
subject
is subject email, this field is require
template
is template email you need to setup, but create first template email like on folder templates
data
is object data, will use on the template email. like said, you need to write Full Name the reciever you send the email or any else you want to write on the template
API
sendOne
example:
Mailer.sendOne(dataEmail);
dataEmail
is the object of parameter you need to send