0.5.5 • Published 4 years ago

rf-api-mailer v0.5.5

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

rf-api-mailer

Gets Mails settings and starts simpleTemplateMailer.

Getting Started

npm install rf-api-mailer

Init the service

var mailerOptions ={
   transporter: mainOptions., // nodemailer transporter
   defaultLanguage: 'en',
   contactMail: 'your@contactMail.com' // optional
   translationsPath: 'mail/translations',
   templatesPath: 'mail/templates',
   inlineAttribute: 'inline' // all html tags with this attribute will be "inlined" by "inline-source"
});

var services: {
   sendMail: require('rf-api-mailer').start(mailerOptions).sendMail
}

Assuming, that templates and translations are in one folder you might pass the path options direct like:

var mailerOptions ={
   transporter: mainOptions., // nodemailer transporter
   defaultLanguage: 'en',
   contactMail: 'your@contactMail.com' // optional
});

var mailPath = 'mail';

var services: {
   sendMail: require('rf-api-mailer').start(mailerOptions, mailPath).sendMail
}

Use the service

var template = {
   name: 'newsletter',
   language: "en",
   data: {test: 234} // data from your app inserted in template
   inlineAttribute: "inline" // optional: individual inline configuration
};

var mailOptions = {to:["max.mustermann@gmx.net"]}; // nodemailer options


// simple example
services.sendMail(template, mailOptions, function(err, data){
   console.log(err, data)
});

// with rf-api
API.post('/sendmail', function(req, res){
   services.sendMail(req.data.template, req.data.mailOptions, res.send);
})

Development

Install the dev tools with

npm install

Then you can runs some test cases and eslint with:

npm test

Legal Issues

  • License: MIT
  • Author: Rapidfacture GmbH
0.5.5

4 years ago

0.5.0

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago