0.1.0 • Published 8 years ago

booljs-mailer v0.1.0

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
8 years ago

Bool.js - Mailer Middleware

Build Status Dependencies status for booljs-mailer devDependency Status Code Climate Inline docs

booljs-mailer NPM icon

Join the chat at https://gitter.im/BoolJS/booljs-mailer

Description

booljs-multer allows developers to send mails through the API using nodemailer package.

Install

Run,

npm i -S booljs-mailer

Configure

Create a configuration file called mail.json. To find out the settings for this file, refer to nodemailer's documentation.

{
    "options": {
        "service": "Mailgun",
        "auth": {
            "user": "postmaster@example.com",
            "pass": "<password>"
        }
    }
}

Usage

In controllers' handlers, use it as part of the request.mail object.

module.exports = function(app){
    var User = app.dao.User
    ,   Json = new app.views.Json();

    // ...

    this.sendList = function(req, res){
        User.list(function(users) {
            req.mail.sendMail({
                // Here you can use nodemailers' options for sendMail
            }, function(err) {
                if(err) json.error(err, res);
                json.standard(false, res);
            });
        });

    };

    // ...

};

FAQ

What is bool.js?

Bool.js is an MVC Framework. But is not just any other framework; it gives us back the power to choose how to organize a well-designed project, so we can choose our dependencies, craft our architecture, choose our data connectors, and finally, work based on cool development structures without hesitating about learning the framework as is.

Bool.js also reminds the importance of having a cool workspace structure. That's why it's based on namespaces, leading us to focus on our code rather than focusing on managing complicated references to other files in our project.

Can I migrate my projects to bool.js?

Of course you can. Bool.js is Free Software (not as in a free beer, but in free as a bird). Just remember to update all of your dependencies, arrange your code in the right project structure (we're very tight at that) and finally, use Node.js 4.0.0 or further versions.